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 729729end
730730
731731@testset " symmetric()/hermitian() for Numbers" begin
732- @test LinearAlgebra. symmetric (1 , :U ) == 1
732+ @test LinearAlgebra. symmetric (1 ) == LinearAlgebra . symmetric ( 1 , :U ) == 1
733733 @test LinearAlgebra. symmetric_type (Int) == Int
734- @test LinearAlgebra. hermitian (1 , :U ) == 1
734+ @test LinearAlgebra. hermitian (1 ) == LinearAlgebra . hermitian ( 1 , :U ) == 1
735735 @test LinearAlgebra. hermitian_type (Int) == Int
736736end
737737
902902 end
903903end
904904
905+ @testset " symmetric/hermitian for matrices" begin
906+ A = [1 2 ; 3 4 ]
907+ @test LinearAlgebra. symmetric (A) === Symmetric (A)
908+ @test LinearAlgebra. symmetric (A, :L ) === Symmetric (A, :L )
909+ @test LinearAlgebra. hermitian (A) === Hermitian (A)
910+ @test LinearAlgebra. hermitian (A, :L ) === Hermitian (A, :L )
911+ end
912+
905913@testset " custom axes" begin
906914 SZA = SizedArrays. SizedArray {(2,2)} ([1 2 ; 3 4 ])
907915 for T in (Symmetric, Hermitian)
You can’t perform that action at this time.
0 commit comments