Skip to content

Commit

Permalink
Fixed typo.
Browse files Browse the repository at this point in the history
  • Loading branch information
benedict-96 committed Dec 13, 2023
1 parent a94c57c commit c6a350e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 46 deletions.
4 changes: 2 additions & 2 deletions test/arrays/addition_tests_for_custom_arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function addition_tests_for_custom_arrays(n::Int, N::Int, T::Type)
# SkewSymMatrix
AB_skew = SkewSymMatrix(A + B)
AB_skew2 = SkewSymMatrix(A) + SkewSymMatrix(B)
@test A_skew A_skew2
@test AB_skew AB_skew2
@test typeof(AB_skew) <: SkewSymMatrix{T}
@test typeof(AB_skew2) <: SkewSymMatrix{T}

Expand All @@ -34,7 +34,7 @@ function addition_tests_for_custom_arrays(n::Int, N::Int, T::Type)
CD_glahm = GrassmannLieAlgHorMatrix(C + D, n)
CD_glahm2 = GrassmannLieAlgHorMatrix(C, n) + GrassmannLieAlgHorMatrix(D, n)
@test CD_glahm CD_glahm2
@test tyepof(CD_glahm) <: GrassmannLieAlgHorMatrix{T}
@test typeof(CD_glahm) <: GrassmannLieAlgHorMatrix{T}
@test typeof(CD_glahm2) <: GrassmannLieAlgHorMatrix{T}
end

Expand Down
43 changes: 0 additions & 43 deletions test/arrays/array_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,6 @@ function skew_mat_mul_test2(n, T=Float64)
@test isapprox(AS1, AS2)
end

# check if matrix is ∈ 𝔤 (check if the vector space projection works), addition & subtraction
function sympl_lie_alg_add_sub_test(n)
J = SymplecticPotential(n)
symplectisize(W) = .5*(W - J'*W'*J)
W₁ = rand(2*n,2*n)
S₁ = SymplecticLieAlgMatrix(W₁)
W₂ = rand(2*n,2*n)
S₂ = SymplecticLieAlgMatrix(W₂)
S₃ = S₁ + S₂
S₄ = S₁ - S₂
@test typeof(S₃) <: SymplecticLieAlgMatrix
@test typeof(S₄) <: SymplecticLieAlgMatrix
@test all(abs.(symplectisize(W₁ + W₂) .- S₃) .< 1e-10)
@test all(abs.(symplectisize(W₁ - W₂) .- S₄) .< 1e-10)
end

# test Stiefel manifold projection test
function stiefel_proj_test(N,n)
Expand All @@ -84,14 +69,6 @@ function stiefel_proj_test(N,n)
@test all(abs.((E'*E) .- In) .< 1e-10)
end

# test symplectic projection (this is just the E matrix)
function sympl_proj_test(N, n)
JN = SymplecticPotential(N)
Jn = SymplecticPotential(n)
E = SymplecticProjection(N, n, Float64)
@test all(abs.((E'*JN*E) .- Jn) .< 1e-10)
end


function stiefel_lie_alg_add_sub_test(N, n)
E = StiefelProjection(N, n)
Expand All @@ -108,23 +85,6 @@ function stiefel_lie_alg_add_sub_test(N, n)
@test all(abs.(projection(W₁ - W₂) .- S₄) .< 1e-10)
end

# check if matrix is ∈ 𝔤 (check if the vector space projection works), addition & subtraction
function sympl_lie_alg_add_sub_test(N, n)
J = SymplecticPotential(n)
E = SymplecticProjection(N, n)
projection(W::SymplecticLieAlgMatrix) = W - (I - E*E')*W*(I - E*E')
W₁ = SymplecticLieAlgMatrix(rand(2*N,2*N))
S₁ = SymplecticLieAlgHorMatrix(W₁,n)
W₂ = SymplecticLieAlgMatrix(rand(2*N,2*N))
S₂ = SymplecticLieAlgHorMatrix(W₂,n)
S₃ = S₁ + S₂
S₄ = S₁ - S₂
@test typeof(S₃) <: SymplecticLieAlgHorMatrix
@test typeof(S₄) <: SymplecticLieAlgHorMatrix
@test all(abs.(projection(W₁ + W₂) .- S₃) .< 1e-10)
@test all(abs.(projection(W₁ - W₂) .- S₄) .< 1e-10)
end

function stiefel_lie_alg_vectorization_test(N, n; T=Float32)
A = rand(StiefelLieAlgHorMatrix{T}, N, n)
@test isapprox(StiefelLieAlgHorMatrix(vec(A), N, n), A)
Expand All @@ -149,10 +109,7 @@ for (N, n) ∈ zip(N_vec, n_vec)
skew_mat_add_sub_test(N)
skew_mat_mul_test(N)
skew_mat_mul_test2(N)
sympl_lie_alg_add_sub_test(N)
stiefel_proj_test(N,n)
sympl_proj_test(N,n)
stiefel_lie_alg_add_sub_test(N,n)
sympl_lie_alg_add_sub_test(N,n)
stiefel_lie_alg_vectorization_test(N, n)
end
2 changes: 1 addition & 1 deletion test/arrays/scalar_multiplication_for_custom_arrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function scalar_multiplication_for_custom_arrays(n::Int, N::Int, T::Type)
Cα_glahm = GrassmannLieAlgHorMatrix* C, n)
Cα_glahm2 = α * GrassmannLieAlgHorMatrix(C, n)
@test Cα_glahm Cα_glahm2
@test tyepof(Cα_glahm) <: GrassmannLieAlgHorMatrix{T}
@test typeof(Cα_glahm) <: GrassmannLieAlgHorMatrix{T}
@test typeof(Cα_glahm2) <: GrassmannLieAlgHorMatrix{T}
end

Expand Down

0 comments on commit c6a350e

Please sign in to comment.