File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ If a symmetric view of a matrix is to be constructed of which the elements are n
7373matrices nor numbers, an appropriate method of `symmetric` has to be implemented. In that
7474case, `symmetric_type` has to be implemented, too.
7575"""
76- symmetric (A:: AbstractMatrix , uplo:: Symbol ) = Symmetric (A, uplo)
77- symmetric (A:: Number , :: Symbol ) = A
76+ symmetric (A:: AbstractMatrix , uplo:: Symbol = :U ) = Symmetric (A, uplo)
77+ symmetric (A:: Number , :: Symbol = :U ) = A
7878
7979"""
8080 symmetric_type(T::Type)
@@ -164,8 +164,8 @@ If a hermitian view of a matrix is to be constructed of which the elements are n
164164matrices nor numbers, an appropriate method of `hermitian` has to be implemented. In that
165165case, `hermitian_type` has to be implemented, too.
166166"""
167- hermitian (A:: AbstractMatrix , uplo:: Symbol ) = Hermitian (A, uplo)
168- hermitian (A:: Number , :: Symbol ) = convert (typeof (A), real (A))
167+ hermitian (A:: AbstractMatrix , uplo:: Symbol = :U ) = Hermitian (A, uplo)
168+ hermitian (A:: Number , :: Symbol = :U ) = convert (typeof (A), real (A))
169169
170170"""
171171 hermitian_type(T::Type)
Original file line number Diff line number Diff line change 727727end
728728
729729@testset " symmetric()/hermitian() for Numbers" begin
730- @test LinearAlgebra. symmetric (1 , :U ) == 1
730+ @test LinearAlgebra. symmetric (1 ) == LinearAlgebra . symmetric ( 1 , :U ) == 1
731731 @test LinearAlgebra. symmetric_type (Int) == Int
732- @test LinearAlgebra. hermitian (1 , :U ) == 1
732+ @test LinearAlgebra. hermitian (1 ) == LinearAlgebra . hermitian ( 1 , :U ) == 1
733733 @test LinearAlgebra. hermitian_type (Int) == Int
734734end
735735
900900 end
901901end
902902
903+ @testset " symmetric/hermitian for matrices" begin
904+ A = [1 2 ; 3 4 ]
905+ @test LinearAlgebra. symmetric (A) === Symmetric (A)
906+ @test LinearAlgebra. symmetric (A, :L ) === Symmetric (A, :L )
907+ @test LinearAlgebra. hermitian (A) === Hermitian (A)
908+ @test LinearAlgebra. hermitian (A, :L ) === Hermitian (A, :L )
909+ end
910+
903911end # module TestSymmetric
You can’t perform that action at this time.
0 commit comments