@@ -843,3 +843,101 @@ end
843843 @test M_temp ≈ ((Lx3* M)[1 : N,2 : N+ 1 ,2 : N+ 1 ] + (Ly3* M)[2 : N+ 1 ,1 : N,2 : N+ 1 ] + (Lz3* M)[2 : N+ 1 ,2 : N+ 1 ,1 : N] + (Lx4* M)[1 : N,2 : N+ 1 ,2 : N+ 1 ] + (Ly4* M)[2 : N+ 1 ,1 : N,2 : N+ 1 ] + (Lz4* M)[2 : N+ 1 ,2 : N+ 1 ,1 : N])
844844
845845end
846+
847+ @testset " 3D Multiplication with differing bpc and dx = dy = dz = 1.0" begin
848+
849+ N = 100
850+ M = zeros (N+ 2 ,N+ 2 ,N+ 2 )
851+ for i in 1 : N+ 2
852+ for j in 1 : N+ 2
853+ for k in 1 : N+ 2
854+ M[i,j,k] = cos (0.1 i)+ sin (0.1 j) + exp (0.01 k)
855+ end
856+ end
857+ end
858+
859+ # Lx2 has 0 boundary points
860+ Lx2 = CenteredDifference {1} (2 ,2 ,1.0 ,N)
861+ # Lx3 has 1 boundary point
862+ Lx3 = CenteredDifference {1} (3 ,3 ,1.0 ,N)
863+ # Lx4 has 2 boundary points
864+ Lx4 = CenteredDifference {1} (4 ,4 ,1.0 ,N)
865+
866+ # Test a single axis, multiple operators: (Lxx+Lxxxx)*M, dx = 1.0
867+ A = Lx2+ Lx4
868+ M_temp = zeros (N,N+ 2 ,N+ 2 )
869+ mul! (M_temp, A, M)
870+ @test M_temp ≈ ((Lx2* M) + (Lx4* M))
871+
872+ # Test a single axis, multiple operators: (Lxx++Lxxx+Lxxxx)*M, dx = 1.0
873+ A += Lx3
874+ mul! (M_temp, A, M)
875+ @test M_temp ≈ ((Lx2* M) + (Lx3* M) + (Lx4* M))
876+
877+
878+ # Ly2 has 0 boundary points
879+ Ly2 = CenteredDifference {2} (2 ,2 ,1.0 ,N)
880+ # Ly3 has 1 boundary point
881+ Ly3 = CenteredDifference {2} (3 ,3 ,1.0 ,N)
882+ # Ly4 has 2 boundary points
883+ Ly4 = CenteredDifference {2} (4 ,4 ,1.0 ,N)
884+
885+ # Test a single axis, multiple operators: (Lyy+Lyyyy)*M, dx = 1.0
886+ A = Ly2+ Ly4
887+ M_temp = zeros (N+ 2 ,N,N+ 2 )
888+ mul! (M_temp, A, M)
889+ @test M_temp ≈ ((Ly2* M) + (Ly4* M))
890+
891+ # Test a single axis, multiple operators: (Lyy++Lyyy+Lyyyy)*M, dx = 1.0
892+ A += Ly3
893+ mul! (M_temp, A, M)
894+ @test M_temp ≈ ((Ly2* M) + (Ly3* M) + (Ly4* M))
895+
896+
897+ # Lz2 has 0 boundary points
898+ Lz2 = CenteredDifference {3} (2 ,2 ,1.0 ,N)
899+ # Lz3 has 1 boundary point
900+ Lz3 = CenteredDifference {3} (3 ,3 ,1.0 ,N)
901+ # Lz4 has 2 boundary points
902+ Lz4 = CenteredDifference {3} (4 ,4 ,1.0 ,N)
903+
904+ # Test a single axis, multiple operators: (Lzy+Lzzzz)*M, dz = 1.0
905+ A = Lz2+ Lz4
906+ M_temp = zeros (N+ 2 ,N+ 2 ,N)
907+ mul! (M_temp, A, M)
908+ @test M_temp ≈ ((Lz2* M) + (Lz4* M))
909+
910+ # Test a single axis, multiple operators: (Lzz++Lzzz+Lzzzz)*M, dz = 1.0
911+ A += Lz3
912+ mul! (M_temp, A, M)
913+ @test M_temp ≈ ((Lz2* M) + (Lz3* M) + (Lz4* M))
914+
915+ # Test multiple operators on two axis: (Lxx + Lyy + Lxxx + Lyyy + Lxxxx + Lyyyy)*M, no coefficient
916+ A = Lx2 + Ly2 + Lx3 + Ly3 + Lx4 + Ly4
917+ M_temp = zeros (N,N,N+ 2 )
918+ mul! (M_temp, A, M)
919+
920+ @test M_temp ≈ ((Lx2* M)[1 : N,2 : N+ 1 ,:]+ (Ly2* M)[2 : N+ 1 ,1 : N,:]+ (Lx3* M)[1 : N,2 : N+ 1 ,:] + (Ly3* M)[2 : N+ 1 ,1 : N,:] + (Lx4* M)[1 : N,2 : N+ 1 ,:] + (Ly4* M)[2 : N+ 1 ,1 : N,:])
921+
922+ # Test multiple operators on two axis: (Lxx + Lzz + Lxxx + Lzzz + Lxxxx + Lzzzz)*M, no coefficient
923+ A = Lx2 + Lz2 + Lx3 + Lz3 + Lx4 + Lz4
924+ M_temp = zeros (N,N+ 2 ,N)
925+ mul! (M_temp, A, M)
926+
927+ @test M_temp ≈ ((Lx2* M)[1 : N,:,2 : N+ 1 ]+ (Lz2* M)[2 : N+ 1 ,:,1 : N]+ (Lx3* M)[1 : N,:,2 : N+ 1 ] + (Lz3* M)[2 : N+ 1 ,:,1 : N] + (Lx4* M)[1 : N,:,2 : N+ 1 ] + (Lz4* M)[2 : N+ 1 ,:,1 : N])
928+
929+ # Test multiple operators on two axis: (Lxx + Lzz + Lxxx + Lzzz + Lxxxx + Lzzzz)*M, no coefficient
930+ A = Ly2 + Lz2 + Ly3 + Lz3 + Ly4 + Lz4
931+ M_temp = zeros (N+ 2 ,N,N)
932+ mul! (M_temp, A, M)
933+
934+ @test M_temp ≈ ((Ly2* M)[:,1 : N,2 : N+ 1 ]+ (Lz2* M)[:,2 : N+ 1 ,1 : N]+ (Ly3* M)[:,1 : N,2 : N+ 1 ] + (Lz3* M)[:,2 : N+ 1 ,1 : N] + (Ly4* M)[:,1 : N,2 : N+ 1 ] + (Lz4* M)[:,2 : N+ 1 ,1 : N])
935+
936+ # Test operators on all three axis (Lxx + Lyy + Lzz + Lxxx + Lyyy + Lzzz + Lxxxx + Lyyyy + Lzzzz)*M, no coefficient
937+ A = Lx2 + Ly2 + Lz2 + Lx3 + Ly3 + Lz3 + Lx4 + Ly4 + Lz4
938+ M_temp = zeros (N,N,N)
939+ mul! (M_temp, A, M)
940+ @test M_temp ≈ ((Lx2* M)[1 : N,2 : N+ 1 ,2 : N+ 1 ]+ (Ly2* M)[2 : N+ 1 ,1 : N,2 : N+ 1 ]+ (Lz2* M)[2 : N+ 1 ,2 : N+ 1 ,1 : N]+ (Lx3* M)[1 : N,2 : N+ 1 ,2 : N+ 1 ] + (Ly3* M)[2 : N+ 1 ,1 : N,2 : N+ 1 ]
941+ + (Lz3* M)[2 : N+ 1 ,2 : N+ 1 ,1 : N] + (Lx4* M)[1 : N,2 : N+ 1 ,2 : N+ 1 ] + (Ly4* M)[2 : N+ 1 ,1 : N,2 : N+ 1 ])+ (Lz4* M)[2 : N+ 1 ,2 : N+ 1 ,1 : N]
942+
943+ end
0 commit comments