diff --git a/test/toeplitzplanstests.jl b/test/toeplitzplanstests.jl index 46b13f98..6ea6a095 100644 --- a/test/toeplitzplanstests.jl +++ b/test/toeplitzplanstests.jl @@ -54,12 +54,66 @@ import FastTransforms: plan_uppertoeplitz! @test PX[:,j,:] ≈ X[:,j,:]*T' end + P = plan_uppertoeplitz!([1,2,3], size(X), (1,3)) + PX = P * copy(X) + for j = 1:size(X,2) + @test PX[:,j,:] ≈ T*X[:,j,:]*T' + end + + P = plan_uppertoeplitz!([1,2,3], size(X), 1:3) + PX = P * copy(X) + M = copy(X) + for j = 1:size(X,3) + M[:,:,j] = T*M[:,:,j]*T' + end + for k = 1:size(X,1) + M[k,:,:] = M[k,:,:]*T' + end + @test M ≈ PX + end - # P = plan_uppertoeplitz!([1,2,3], size(X), 1:3) - # PX = P * copy(X) - # for j = 1:size(X,2) - # @test PX[:,j,:] ≈ X[:,j,:]*T' - # end + @testset "4D" begin + X = randn(3,3,3,3) + P = plan_uppertoeplitz!([1,2,3], size(X), 1) + PX = P * copy(X) + for ℓ = 1:size(X,3), m = 1:size(X,4) + @test PX[:,:,ℓ,m] ≈ T*X[:,:,ℓ,m] + end + + P = plan_uppertoeplitz!([1,2,3], size(X), 2) + PX = P * copy(X) + for ℓ = 1:size(X,3), m = 1:size(X,4) + @test PX[:,:,ℓ,m] ≈ X[:,:,ℓ,m]*T' + end + + P = plan_uppertoeplitz!([1,2,3], size(X), 3) + PX = P * copy(X) + for j = 1:size(X,2), m = 1:size(X,4) + @test PX[:,j,:,m] ≈ X[:,j,:,m]*T' + end + + P = plan_uppertoeplitz!([1,2,3], size(X), 4) + PX = P * copy(X) + for k = 1:size(X,1), j = 1:size(X,2) + @test PX[k,j,:,:] ≈ X[k,j,:,:]*T' + end + + P = plan_uppertoeplitz!([1,2,3], size(X), (1,3)) + PX = P * copy(X) + for j = 1:size(X,2), m=1:size(X,4) + @test PX[:,j,:,m] ≈ T*X[:,j,:,m]*T' + end + + P = plan_uppertoeplitz!([1,2,3], size(X), 1:4) + PX = P * copy(X) + M = copy(X) + for ℓ = 1:size(X,3), m = 1:size(X,4) + M[:,:,ℓ,m] = T*M[:,:,ℓ,m]*T' + end + for k = 1:size(X,1), j = 1:size(X,2) + M[k,j,:,:] = T*M[k,j,:,:]*T' + end + @test M ≈ PX end end