Skip to content

Commit

Permalink
4-tensor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Nov 11, 2023
1 parent 71b3476 commit 3906bc0
Showing 1 changed file with 59 additions and 5 deletions.
64 changes: 59 additions & 5 deletions test/toeplitzplanstests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3906bc0

Please sign in to comment.