@@ -28,7 +28,7 @@ using Test, LinearMaps, LinearAlgebra, SparseArrays
2828 @test @inferred F4 * v == @inferred F * (F * (F * (F * v)))
2929 @test @inferred Matrix (M * transpose (M)) ≈ A * transpose (A)
3030 @test @inferred ! isposdef (M * transpose (M))
31- @test @inferred isposdef (M * M' )
31+ @test @inferred isposdef (LinearMap ( M * M' , isposdef = true ) )
3232 @test @inferred issymmetric (N * N' )
3333 @test @inferred ishermitian (N * N' )
3434 @test @inferred ! issymmetric (M' * M)
@@ -40,10 +40,10 @@ using Test, LinearMaps, LinearAlgebra, SparseArrays
4040 @test @inferred ! issymmetric (FC' FC)
4141 @test @inferred ishermitian (FC' FC)
4242 @test @inferred ishermitian (FC' * H* FC)
43- @test @inferred isposdef (transpose (F) * F * 3 )
44- @test @inferred isposdef (transpose (F) * 3 * F)
43+ @test @inferred issymmetric (transpose (F) * F * 3 )
44+ @test @inferred issymmetric (transpose (F) * 3 * F)
4545 @test @inferred ! isposdef (- 5 * transpose (F) * F)
46- @test @inferred isposdef ((M * F)' * M * 4 * F)
46+ @test @inferred ishermitian ((M * F)' * M * 4 * F)
4747 @test @inferred transpose (M * F) == @inferred transpose (F) * transpose (M)
4848 @test @inferred (4 * ((- 3 * M)* 2 )) == @inferred - 12 M* 2
4949 @test @inferred (4 * ((3 * (- M))* 2 )* (- 5 )) == @inferred - 12 M* (- 10 )
@@ -132,4 +132,10 @@ using Test, LinearMaps, LinearAlgebra, SparseArrays
132132 X = rand (size (Ls, 2 ), 10 )
133133 Y = similar (X, (size (Ls, 1 ), size (X, 2 )))
134134 @test mul! (Y, Ls, X) ≈ L4. lmap * L3. lmap * L2. lmap * L1. lmap * X
135+
136+ # test isposdef on a case where sufficient conditions work
137+ B = LinearMap ([1 0 ; 0 1 ], isposdef= true ) # isposdef!
138+ C = B' * B * B * B * B # no B' at end on purpose
139+ @test @inferred isposdef (C)
140+ @test @inferred isposdef (B * B) # even case for empty tuple test
135141end
0 commit comments