From 08b85f12c1954874ec2eacccaf9aeb28fa37a961 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Mon, 9 Sep 2024 12:19:25 +0100 Subject: [PATCH 01/17] test(core): fix typo in function name --- test/matrices/binomial.jl | 2 +- test/matrices/cauchy.jl | 2 +- test/matrices/chebspec.jl | 2 +- test/matrices/chow.jl | 2 +- test/matrices/circulant.jl | 2 +- test/matrices/clement.jl | 2 +- test/matrices/companion.jl | 2 +- test/matrices/comparison.jl | 2 +- test/matrices/cycol.jl | 2 +- test/matrices/dingdong.jl | 2 +- test/matrices/dorr.jl | 2 +- test/matrices/dramadah.jl | 2 +- test/matrices/fiedler.jl | 2 +- test/matrices/forsythe.jl | 2 +- test/matrices/frank.jl | 2 +- test/matrices/gcdmat.jl | 2 +- test/matrices/gearmat.jl | 2 +- test/matrices/golub.jl | 2 +- test/matrices/grcar.jl | 2 +- test/matrices/hadamard.jl | 2 +- test/matrices/hankel.jl | 2 +- test/matrices/hanowa.jl | 2 +- test/matrices/hilbert.jl | 2 +- test/matrices/inversehilbert.jl | 4 ++-- test/matrices/invhess.jl | 2 +- test/matrices/involutory.jl | 2 +- test/matrices/ipjfact.jl | 2 +- test/matrices/jordbloc.jl | 2 +- test/matrices/kahan.jl | 2 +- test/matrices/kms.jl | 6 +++--- test/matrices/krylov.jl | 2 +- test/matrices/lehmer.jl | 2 +- test/matrices/leslie.jl | 2 +- test/matrices/lesp.jl | 2 +- test/matrices/lotkin.jl | 2 +- test/matrices/magic.jl | 2 +- test/matrices/minij.jl | 2 +- test/matrices/moler.jl | 2 +- test/matrices/neumann.jl | 2 +- test/matrices/orthog.jl | 2 +- test/matrices/oscillate.jl | 2 +- test/matrices/parter.jl | 2 +- test/matrices/pascal.jl | 2 +- test/matrices/pei.jl | 2 +- test/matrices/poisson.jl | 2 +- test/matrices/prolate.jl | 2 +- test/matrices/randcolu.jl | 2 +- test/matrices/randcorr.jl | 2 +- test/matrices/randjorth.jl | 2 +- test/matrices/rando.jl | 2 +- test/matrices/randsvd.jl | 2 +- test/matrices/redheff.jl | 2 +- test/matrices/riemann.jl | 2 +- test/matrices/ris.jl | 2 +- test/matrices/rohess.jl | 2 +- test/matrices/rosser.jl | 2 +- test/matrices/sampling.jl | 2 +- test/matrices/smoke.jl | 2 +- test/matrices/toeplitz.jl | 2 +- test/matrices/triw.jl | 2 +- test/matrices/wathen.jl | 2 +- test/matrices/wilkinson.jl | 2 +- test/runtests.jl | 6 +++--- 63 files changed, 68 insertions(+), 68 deletions(-) diff --git a/test/matrices/binomial.jl b/test/matrices/binomial.jl index 29a49ee..1274309 100644 --- a/test/matrices/binomial.jl +++ b/test/matrices/binomial.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Binomial.(1:5)) +run_test_linear_algebra_functions(Binomial.(1:5)) # eltype @test test_matrix_elements(Binomial{Int32}(5)) diff --git a/test/matrices/cauchy.jl b/test/matrices/cauchy.jl index 9e192c2..9fc86e6 100644 --- a/test/matrices/cauchy.jl +++ b/test/matrices/cauchy.jl @@ -12,7 +12,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Cauchy{Float64}.(1:5)) +run_test_linear_algebra_functions(Cauchy{Float64}.(1:5)) # eltype @test test_matrix_elements(Cauchy{Float32}(5)) diff --git a/test/matrices/chebspec.jl b/test/matrices/chebspec.jl index d935403..935c2dd 100644 --- a/test/matrices/chebspec.jl +++ b/test/matrices/chebspec.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(ChebSpec.(1:5)) +run_test_linear_algebra_functions(ChebSpec.(1:5)) # eltype @test test_matrix_elements(ChebSpec{Float32}(5)) diff --git a/test/matrices/chow.jl b/test/matrices/chow.jl index ed0464b..af237f8 100644 --- a/test/matrices/chow.jl +++ b/test/matrices/chow.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions([Chow.(1:5); Chow.(1:5, 2, 3)]) +run_test_linear_algebra_functions([Chow.(1:5); Chow.(1:5, 2, 3)]) # eltype @test test_matrix_elements(Chow{Int32}(5)) diff --git a/test/matrices/circulant.jl b/test/matrices/circulant.jl index c371647..a2ebe98 100644 --- a/test/matrices/circulant.jl +++ b/test/matrices/circulant.jl @@ -6,7 +6,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Circulant.(1:5)) +run_test_linear_algebra_functions(Circulant.(1:5)) # eltype @test test_matrix_elements(Circulant{Int32}(5)) diff --git a/test/matrices/clement.jl b/test/matrices/clement.jl index e7be858..25d9f91 100644 --- a/test/matrices/clement.jl +++ b/test/matrices/clement.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Clement.(1:5)) +run_test_linear_algebra_functions(Clement.(1:5)) # eltype @test test_matrix_elements(Clement{Float32}(5)) diff --git a/test/matrices/companion.jl b/test/matrices/companion.jl index 06ab4e1..1dc8478 100644 --- a/test/matrices/companion.jl +++ b/test/matrices/companion.jl @@ -10,7 +10,7 @@ using Polynomials: Polynomial ]) # linear algebra functions -run_test_linearalgrbra_functions(Companion.(1:5)) +run_test_linear_algebra_functions(Companion.(1:5)) # eltype @test test_matrix_elements(Companion{Float32}(5)) diff --git a/test/matrices/comparison.jl b/test/matrices/comparison.jl index 54038c0..060b678 100644 --- a/test/matrices/comparison.jl +++ b/test/matrices/comparison.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Comparison.(Minij.(1:5))) +run_test_linear_algebra_functions(Comparison.(Minij.(1:5))) # eltype @test test_matrix_elements(Comparison(Minij{Int32}(5))) diff --git a/test/matrices/cycol.jl b/test/matrices/cycol.jl index 332aaec..b6ded10 100644 --- a/test/matrices/cycol.jl +++ b/test/matrices/cycol.jl @@ -9,7 +9,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Cycol.(1:5)) +run_test_linear_algebra_functions(Cycol.(1:5)) # eltype @test test_matrix_elements(Cycol{Float32}(5)) diff --git a/test/matrices/dingdong.jl b/test/matrices/dingdong.jl index 06587fd..9aaf514 100644 --- a/test/matrices/dingdong.jl +++ b/test/matrices/dingdong.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(DingDong.(1:5)) +run_test_linear_algebra_functions(DingDong.(1:5)) # eltype @test test_matrix_elements(DingDong{Int32}(5)) diff --git a/test/matrices/dorr.jl b/test/matrices/dorr.jl index 6693bb2..a405495 100644 --- a/test/matrices/dorr.jl +++ b/test/matrices/dorr.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Dorr.(1:5)) +run_test_linear_algebra_functions(Dorr.(1:5)) # eltype @test test_matrix_elements(Dorr{Float32}(5)) diff --git a/test/matrices/dramadah.jl b/test/matrices/dramadah.jl index 6a7a59d..4eca9b1 100644 --- a/test/matrices/dramadah.jl +++ b/test/matrices/dramadah.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Dramadah.(1:5)) +run_test_linear_algebra_functions(Dramadah.(1:5)) # eltype @test test_matrix_elements(Dramadah{Int32}(5)) diff --git a/test/matrices/fiedler.jl b/test/matrices/fiedler.jl index b44ecb3..1431803 100644 --- a/test/matrices/fiedler.jl +++ b/test/matrices/fiedler.jl @@ -6,7 +6,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Fiedler.(1:5)) +run_test_linear_algebra_functions(Fiedler.(1:5)) # eltype @test test_matrix_elements(Fiedler{Int32}(5)) diff --git a/test/matrices/forsythe.jl b/test/matrices/forsythe.jl index dc54c0b..f6243fb 100644 --- a/test/matrices/forsythe.jl +++ b/test/matrices/forsythe.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Forsythe.(1:5)) +run_test_linear_algebra_functions(Forsythe.(1:5)) # eltype @test test_matrix_elements(Forsythe{Float32}(5)) diff --git a/test/matrices/frank.jl b/test/matrices/frank.jl index f037ebf..56b5ab6 100644 --- a/test/matrices/frank.jl +++ b/test/matrices/frank.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Frank.(1:5)) +run_test_linear_algebra_functions(Frank.(1:5)) # eltype @test test_matrix_elements(Frank{Int32}(5)) diff --git a/test/matrices/gcdmat.jl b/test/matrices/gcdmat.jl index b7344e0..d656cd5 100644 --- a/test/matrices/gcdmat.jl +++ b/test/matrices/gcdmat.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(GCDMat.(1:5)) +run_test_linear_algebra_functions(GCDMat.(1:5)) # eltype @test test_matrix_elements(GCDMat{Int32}(5)) diff --git a/test/matrices/gearmat.jl b/test/matrices/gearmat.jl index 3812c79..0bbc815 100644 --- a/test/matrices/gearmat.jl +++ b/test/matrices/gearmat.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(GearMat.(1:5)) +run_test_linear_algebra_functions(GearMat.(1:5)) # eltype @test test_matrix_elements(GearMat{Int32}(5)) diff --git a/test/matrices/golub.jl b/test/matrices/golub.jl index 2ff9502..f7b4400 100644 --- a/test/matrices/golub.jl +++ b/test/matrices/golub.jl @@ -6,7 +6,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Golub.(1:5)) +run_test_linear_algebra_functions(Golub.(1:5)) # eltype @test test_matrix_elements(Golub{Int32}(5)) diff --git a/test/matrices/grcar.jl b/test/matrices/grcar.jl index 0245f86..518ec53 100644 --- a/test/matrices/grcar.jl +++ b/test/matrices/grcar.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Grcar.(1:5)) +run_test_linear_algebra_functions(Grcar.(1:5)) # eltype @test test_matrix_elements(Grcar{Int32}(5)) diff --git a/test/matrices/hadamard.jl b/test/matrices/hadamard.jl index 3b75d3b..d2de026 100644 --- a/test/matrices/hadamard.jl +++ b/test/matrices/hadamard.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Hadamard.((2) .^ (1:4))) +run_test_linear_algebra_functions(Hadamard.((2) .^ (1:4))) # eltype @test test_matrix_elements(Hadamard{Int32}(4)) diff --git a/test/matrices/hankel.jl b/test/matrices/hankel.jl index 7832d56..14d4ef5 100644 --- a/test/matrices/hankel.jl +++ b/test/matrices/hankel.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Hankel.(1:5)) +run_test_linear_algebra_functions(Hankel.(1:5)) # eltype @test test_matrix_elements(Hankel{Int32}(5)) diff --git a/test/matrices/hanowa.jl b/test/matrices/hanowa.jl index 2d5c669..d536837 100644 --- a/test/matrices/hanowa.jl +++ b/test/matrices/hanowa.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Hanowa.(2:2:8)) +run_test_linear_algebra_functions(Hanowa.(2:2:8)) # eltype @test test_matrix_elements(Hanowa{Int32}(6)) diff --git a/test/matrices/hilbert.jl b/test/matrices/hilbert.jl index 9fdd054..8dbf668 100644 --- a/test/matrices/hilbert.jl +++ b/test/matrices/hilbert.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Hilbert.(1:5)) +run_test_linear_algebra_functions(Hilbert.(1:5)) # eltype @test test_matrix_elements(Hilbert{Int32}(5)) diff --git a/test/matrices/inversehilbert.jl b/test/matrices/inversehilbert.jl index 33f2416..5788890 100644 --- a/test/matrices/inversehilbert.jl +++ b/test/matrices/inversehilbert.jl @@ -6,8 +6,8 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(InverseHilbert.(1:5)) -@test test_linearalgrbra_functions(InverseHilbert{BigInt}(5)) +run_test_linear_algebra_functions(InverseHilbert.(1:5)) +run_test_linear_algebra_functions([InverseHilbert{BigInt}(5)]) # eltype @test test_matrix_elements(InverseHilbert{Int32}(5)) diff --git a/test/matrices/invhess.jl b/test/matrices/invhess.jl index 0b0164b..101343f 100644 --- a/test/matrices/invhess.jl +++ b/test/matrices/invhess.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Invhess.(1:5)) +run_test_linear_algebra_functions(Invhess.(1:5)) # eltype @test test_matrix_elements(Invhess{Int32}(5)) diff --git a/test/matrices/involutory.jl b/test/matrices/involutory.jl index 6b1b8ee..a69a175 100644 --- a/test/matrices/involutory.jl +++ b/test/matrices/involutory.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Involutory.(1:5)) +run_test_linear_algebra_functions(Involutory.(1:5)) # eltype @test test_matrix_elements(Involutory{Int32}(5)) diff --git a/test/matrices/ipjfact.jl b/test/matrices/ipjfact.jl index 8d78117..df63d2c 100644 --- a/test/matrices/ipjfact.jl +++ b/test/matrices/ipjfact.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Ipjfact.(1:5)) +run_test_linear_algebra_functions(Ipjfact.(1:5)) # eltype @test test_matrix_elements(Ipjfact{Int32}(5)) diff --git a/test/matrices/jordbloc.jl b/test/matrices/jordbloc.jl index 91df7aa..779322f 100644 --- a/test/matrices/jordbloc.jl +++ b/test/matrices/jordbloc.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(JordBloc.(1:5)) +run_test_linear_algebra_functions(JordBloc.(1:5)) # eltype @test test_matrix_elements(JordBloc{Int32}(5)) diff --git a/test/matrices/kahan.jl b/test/matrices/kahan.jl index 6385aaa..6f6f4aa 100644 --- a/test/matrices/kahan.jl +++ b/test/matrices/kahan.jl @@ -11,7 +11,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Kahan.(1:5)) +run_test_linear_algebra_functions(Kahan.(1:5)) # eltype @test test_matrix_elements(Kahan{Float32}(5)) diff --git a/test/matrices/kms.jl b/test/matrices/kms.jl index 7b882f8..f416242 100644 --- a/test/matrices/kms.jl +++ b/test/matrices/kms.jl @@ -8,9 +8,9 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(KMS.(1:5)) -run_test_linearalgrbra_functions(KMS.(1:5, 3)) -run_test_linearalgrbra_functions(KMS.(1:5, 3 + 2im)) +run_test_linear_algebra_functions(KMS.(1:5)) +run_test_linear_algebra_functions(KMS.(1:5, 3)) +run_test_linear_algebra_functions(KMS.(1:5, 3 + 2im)) # eltype @test test_matrix_elements(KMS{Float32}(5)) diff --git a/test/matrices/krylov.jl b/test/matrices/krylov.jl index c4af05d..11b83b0 100644 --- a/test/matrices/krylov.jl +++ b/test/matrices/krylov.jl @@ -17,7 +17,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Krylov.(1:5)) +run_test_linear_algebra_functions(Krylov.(1:5)) # eltype @test test_matrix_elements(Krylov{Float32}(5)) diff --git a/test/matrices/lehmer.jl b/test/matrices/lehmer.jl index c7023a8..83540c8 100644 --- a/test/matrices/lehmer.jl +++ b/test/matrices/lehmer.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Lehmer{Float64}.(1:5)) +run_test_linear_algebra_functions(Lehmer{Float64}.(1:5)) # eltype @test test_matrix_elements(Lehmer{Int32}(5)) diff --git a/test/matrices/leslie.jl b/test/matrices/leslie.jl index b68eca5..c50b1e0 100644 --- a/test/matrices/leslie.jl +++ b/test/matrices/leslie.jl @@ -6,7 +6,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Leslie.(1:5)) +run_test_linear_algebra_functions(Leslie.(1:5)) # eltype @test test_matrix_elements(Leslie{Int32}(5)) diff --git a/test/matrices/lesp.jl b/test/matrices/lesp.jl index df8bb78..cb74bf1 100644 --- a/test/matrices/lesp.jl +++ b/test/matrices/lesp.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Lesp.(1:5)) +run_test_linear_algebra_functions(Lesp.(1:5)) # eltype @test test_matrix_elements(Lesp{Float32}(5)) diff --git a/test/matrices/lotkin.jl b/test/matrices/lotkin.jl index 6c25a52..5d12404 100644 --- a/test/matrices/lotkin.jl +++ b/test/matrices/lotkin.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Lotkin.(1:5)) +run_test_linear_algebra_functions(Lotkin.(1:5)) # eltype @test test_matrix_elements(Lotkin{Int32}(5)) diff --git a/test/matrices/magic.jl b/test/matrices/magic.jl index 5483449..d0b7608 100644 --- a/test/matrices/magic.jl +++ b/test/matrices/magic.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Magic.(3:5)) +run_test_linear_algebra_functions(Magic.(3:5)) # eltype @test test_matrix_elements(Magic{Int32}(5)) diff --git a/test/matrices/minij.jl b/test/matrices/minij.jl index 923e49e..7c44e9d 100644 --- a/test/matrices/minij.jl +++ b/test/matrices/minij.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Minij.(1:5)) +run_test_linear_algebra_functions(Minij.(1:5)) # eltype @test test_matrix_elements(Minij{Int32}(5)) diff --git a/test/matrices/moler.jl b/test/matrices/moler.jl index a48d103..8c90421 100644 --- a/test/matrices/moler.jl +++ b/test/matrices/moler.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Moler.(1:5)) +run_test_linear_algebra_functions(Moler.(1:5)) # eltype @test test_matrix_elements(Moler{Float32}(5)) diff --git a/test/matrices/neumann.jl b/test/matrices/neumann.jl index cfe6e69..9236092 100644 --- a/test/matrices/neumann.jl +++ b/test/matrices/neumann.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Neumann.((0:1) .^ 2)) +run_test_linear_algebra_functions(Neumann.((0:1) .^ 2)) # eltype @test test_matrix_elements(Neumann{Int32}(4)) diff --git a/test/matrices/orthog.jl b/test/matrices/orthog.jl index bf21d22..4a5d8b1 100644 --- a/test/matrices/orthog.jl +++ b/test/matrices/orthog.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Orthog.(1:5)) +run_test_linear_algebra_functions(Orthog.(1:5)) # eltype @test test_matrix_elements(Orthog{Float64}(5)) diff --git a/test/matrices/oscillate.jl b/test/matrices/oscillate.jl index 83622ef..82297c9 100644 --- a/test/matrices/oscillate.jl +++ b/test/matrices/oscillate.jl @@ -12,7 +12,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Oscillate.(2:5)) +run_test_linear_algebra_functions(Oscillate.(2:5)) # eltype @test test_matrix_elements(Oscillate{Float32}(5)) diff --git a/test/matrices/parter.jl b/test/matrices/parter.jl index 3624d34..fe3ba6a 100644 --- a/test/matrices/parter.jl +++ b/test/matrices/parter.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Parter.(1:5)) +run_test_linear_algebra_functions(Parter.(1:5)) # eltype @test test_matrix_elements(Parter{Int32}(5)) diff --git a/test/matrices/pascal.jl b/test/matrices/pascal.jl index e882f32..1441a03 100644 --- a/test/matrices/pascal.jl +++ b/test/matrices/pascal.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Pascal.(1:5)) +run_test_linear_algebra_functions(Pascal.(1:5)) # eltype @test test_matrix_elements(Pascal{Int32}(5)) diff --git a/test/matrices/pei.jl b/test/matrices/pei.jl index 0dab730..f15ac6d 100644 --- a/test/matrices/pei.jl +++ b/test/matrices/pei.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Pei.(1:5)) +run_test_linear_algebra_functions(Pei.(1:5)) # eltype @test test_matrix_elements(Pei{Int32}(5)) diff --git a/test/matrices/poisson.jl b/test/matrices/poisson.jl index ec75db4..dcb0203 100644 --- a/test/matrices/poisson.jl +++ b/test/matrices/poisson.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Poisson.((1:3) .^ 2)) +run_test_linear_algebra_functions(Poisson.((1:3) .^ 2)) # eltype @test test_matrix_elements(Poisson{Int32}(4)) diff --git a/test/matrices/prolate.jl b/test/matrices/prolate.jl index 63480a3..1d44f53 100644 --- a/test/matrices/prolate.jl +++ b/test/matrices/prolate.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Prolate.(1:5)) +run_test_linear_algebra_functions(Prolate.(1:5)) # eltype @test test_matrix_elements(Prolate{Float32}(5)) diff --git a/test/matrices/randcolu.jl b/test/matrices/randcolu.jl index 792f1f4..89899e0 100644 --- a/test/matrices/randcolu.jl +++ b/test/matrices/randcolu.jl @@ -16,7 +16,7 @@ x = sqrt(5.0) * x / norm(x) ]) # linear algebra functions -run_test_linearalgrbra_functions(Randcolu.(1:5)) +run_test_linear_algebra_functions(Randcolu.(1:5)) # eltype @test test_matrix_elements(Randcolu{Float32}(5)) diff --git a/test/matrices/randcorr.jl b/test/matrices/randcorr.jl index 5873119..05c0154 100644 --- a/test/matrices/randcorr.jl +++ b/test/matrices/randcorr.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Randcorr.(1:5)) +run_test_linear_algebra_functions(Randcorr.(1:5)) # eltype @test test_matrix_elements(Randcorr{Float32}(5)) diff --git a/test/matrices/randjorth.jl b/test/matrices/randjorth.jl index c3168bc..29a10eb 100644 --- a/test/matrices/randjorth.jl +++ b/test/matrices/randjorth.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Randjorth.(1:5)) +run_test_linear_algebra_functions(Randjorth.(1:5)) # eltype @test test_matrix_elements(Randjorth{Float32}(5)) diff --git a/test/matrices/rando.jl b/test/matrices/rando.jl index d0253d2..b149663 100644 --- a/test/matrices/rando.jl +++ b/test/matrices/rando.jl @@ -13,7 +13,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Rando.(1:5)) +run_test_linear_algebra_functions(Rando.(1:5)) # eltype @test test_matrix_elements(Rando{Float32}(5)) diff --git a/test/matrices/randsvd.jl b/test/matrices/randsvd.jl index efc4e4f..1c6cf1e 100644 --- a/test/matrices/randsvd.jl +++ b/test/matrices/randsvd.jl @@ -17,7 +17,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(RandSVD.(1:5)) +run_test_linear_algebra_functions(RandSVD.(1:5)) # eltype @test test_matrix_elements(RandSVD{Float32}(5)) diff --git a/test/matrices/redheff.jl b/test/matrices/redheff.jl index 5361af2..850da15 100644 --- a/test/matrices/redheff.jl +++ b/test/matrices/redheff.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Redheff.(1:5)) +run_test_linear_algebra_functions(Redheff.(1:5)) # eltype @test test_matrix_elements(Redheff{Int32}(5)) diff --git a/test/matrices/riemann.jl b/test/matrices/riemann.jl index 904edd0..1e801e8 100644 --- a/test/matrices/riemann.jl +++ b/test/matrices/riemann.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Riemann.(1:5)) +run_test_linear_algebra_functions(Riemann.(1:5)) # eltype @test test_matrix_elements(Riemann{Int32}(5)) diff --git a/test/matrices/ris.jl b/test/matrices/ris.jl index a144903..b2a002b 100644 --- a/test/matrices/ris.jl +++ b/test/matrices/ris.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(RIS.(1:5)) +run_test_linear_algebra_functions(RIS.(1:5)) # eltype @test test_matrix_elements(RIS{Int32}(5)) diff --git a/test/matrices/rohess.jl b/test/matrices/rohess.jl index f0bfc34..9d3f8ca 100644 --- a/test/matrices/rohess.jl +++ b/test/matrices/rohess.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Rohess.(1:5)) +run_test_linear_algebra_functions(Rohess.(1:5)) # eltype @test test_matrix_elements(Rohess{Float32}(5)) diff --git a/test/matrices/rosser.jl b/test/matrices/rosser.jl index 4a1e577..c03d735 100644 --- a/test/matrices/rosser.jl +++ b/test/matrices/rosser.jl @@ -11,7 +11,7 @@ @test !isnothing(Rosser(16)) # linear algebra functions -run_test_linearalgrbra_functions(Rosser.((2) .^ (1:2))) +run_test_linear_algebra_functions(Rosser.((2) .^ (1:2))) # eltype @test test_matrix_elements(Rosser{Float32}(4)) diff --git a/test/matrices/sampling.jl b/test/matrices/sampling.jl index 8227147..296852d 100644 --- a/test/matrices/sampling.jl +++ b/test/matrices/sampling.jl @@ -6,7 +6,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Sampling.(1:5)) +run_test_linear_algebra_functions(Sampling.(1:5)) # eltype @test test_matrix_elements(Sampling{Float32}(5)) diff --git a/test/matrices/smoke.jl b/test/matrices/smoke.jl index e4b3f98..3fc01c6 100644 --- a/test/matrices/smoke.jl +++ b/test/matrices/smoke.jl @@ -9,7 +9,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Smoke.(1:5)) +run_test_linear_algebra_functions(Smoke.(1:5)) # eltype @test test_matrix_elements(Smoke{Float32}(5)) diff --git a/test/matrices/toeplitz.jl b/test/matrices/toeplitz.jl index 6e30fc5..381ad45 100644 --- a/test/matrices/toeplitz.jl +++ b/test/matrices/toeplitz.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Toeplitz.(1:5)) +run_test_linear_algebra_functions(Toeplitz.(1:5)) # eltype @test test_matrix_elements(Toeplitz{Int32}(5)) diff --git a/test/matrices/triw.jl b/test/matrices/triw.jl index e196386..cb06045 100644 --- a/test/matrices/triw.jl +++ b/test/matrices/triw.jl @@ -9,7 +9,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Triw.(1:5)) +run_test_linear_algebra_functions(Triw.(1:5)) # eltype @test test_matrix_elements(Triw{Int32}(5)) diff --git a/test/matrices/wathen.jl b/test/matrices/wathen.jl index 8e9364a..3678063 100644 --- a/test/matrices/wathen.jl +++ b/test/matrices/wathen.jl @@ -6,7 +6,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Wathen.(1:5)) +run_test_linear_algebra_functions(Wathen.(1:5)) # eltype @test test_matrix_elements(Wathen{Float32}(5)) diff --git a/test/matrices/wilkinson.jl b/test/matrices/wilkinson.jl index 1cafc5e..66b31c5 100644 --- a/test/matrices/wilkinson.jl +++ b/test/matrices/wilkinson.jl @@ -5,7 +5,7 @@ ]) # linear algebra functions -run_test_linearalgrbra_functions(Wilkinson.(1:5)) +run_test_linear_algebra_functions(Wilkinson.(1:5)) # eltype @test test_matrix_elements(Wilkinson{Float32}(5)) diff --git a/test/runtests.jl b/test/runtests.jl index e80b835..d9f237c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,7 +17,7 @@ function test_matrix_elements(A::AbstractMatrix{T}) where {T} return all(typeof(A[i]) == T for i = eachindex(A)) end -function test_linearalgrbra_functions(A::AbstractMatrix) +function test_linear_algebra_functions(A::AbstractMatrix) # variables matrix = Matrix(A) determinant = det(matrix) @@ -58,9 +58,9 @@ function test_linearalgrbra_functions(A::AbstractMatrix) end end -function run_test_linearalgrbra_functions(matrices::Vector{<:AbstractMatrix}) +function run_test_linear_algebra_functions(matrices::Vector{<:AbstractMatrix}) for matrix = matrices - @test test_linearalgrbra_functions(matrix) + @test test_linear_algebra_functions(matrix) end end From c57ade4b1c17f0f52628cfea4fa4a5838c018a16 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Mon, 9 Sep 2024 12:41:36 +0100 Subject: [PATCH 02/17] refactor(matrices): sort properties alphabetically --- src/metadata.jl | 58 ++++++++-------- src/types.jl | 174 +++++++++++++++++++----------------------------- 2 files changed, 97 insertions(+), 135 deletions(-) diff --git a/src/metadata.jl b/src/metadata.jl index 346d242..11009f2 100644 --- a/src/metadata.jl +++ b/src/metadata.jl @@ -6,43 +6,43 @@ export # property list const PROPERTIES = Dict{Type{<:PropertyTypes.AbstractProperty},Property}( type => Property(symbol) for (type, symbol) = Dict( - PropertyTypes.Symmetric => :symmetric, - PropertyTypes.Inverse => :inverse, - PropertyTypes.IllCond => :illcond, - PropertyTypes.Involutory => :involutory, - PropertyTypes.Integer => :integer, - PropertyTypes.PosDef => :posdef, + PropertyTypes.Bidiagonal => :bidiagonal, + PropertyTypes.Binary => :binary, + PropertyTypes.Circulant => :circulant, + PropertyTypes.Complex => :complex, PropertyTypes.Correlation => :correlation, + PropertyTypes.Defective => :defective, + PropertyTypes.DiagDom => :diagdom, PropertyTypes.Eigen => :eigen, - PropertyTypes.Sparse => :sparse, - PropertyTypes.Random => :random, - PropertyTypes.RegProb => :regprob, + PropertyTypes.FixedSize => :fixedsize, PropertyTypes.Graph => :graph, - PropertyTypes.TotNonNeg => :totnonneg, - PropertyTypes.TotPos => :totpos, - PropertyTypes.InfDiv => :infdiv, + PropertyTypes.Hankel => :hankel, + PropertyTypes.Hessenberg => :hessenberg, + PropertyTypes.IllCond => :illcond, PropertyTypes.Indefinite => :indefinite, - PropertyTypes.Defective => :defective, + PropertyTypes.InfDiv => :infdiv, + PropertyTypes.Integer => :integer, + PropertyTypes.Inverse => :inverse, + PropertyTypes.Involutory => :involutory, PropertyTypes.Nilpotent => :nilpotent, - PropertyTypes.Hessenberg => :hessenberg, - PropertyTypes.Toeplitz => :toeplitz, - PropertyTypes.Binary => :binary, - PropertyTypes.RankDef => :rankdef, - PropertyTypes.Circulant => :circulant, + PropertyTypes.NonNeg => :nonneg, PropertyTypes.Normal => :normal, PropertyTypes.Orthogonal => :orthogonal, - PropertyTypes.Bidiagonal => :bidiagonal, - PropertyTypes.Tridiagonal => :tridiagonal, - PropertyTypes.Triangular => :triangular, - PropertyTypes.SingVal => :singval, - PropertyTypes.Rectangular => :rectangular, - PropertyTypes.Hankel => :hankel, - PropertyTypes.DiagDom => :diagdom, - PropertyTypes.NonNeg => :nonneg, - PropertyTypes.Unimodular => :unimodular, PropertyTypes.Positive => :positive, - PropertyTypes.FixedSize => :fixedsize, - PropertyTypes.Complex => :complex + PropertyTypes.PosDef => :posdef, + PropertyTypes.Random => :random, + PropertyTypes.RankDef => :rankdef, + PropertyTypes.Rectangular => :rectangular, + PropertyTypes.RegProb => :regprob, + PropertyTypes.SingVal => :singval, + PropertyTypes.Sparse => :sparse, + PropertyTypes.Symmetric => :symmetric, + PropertyTypes.Toeplitz => :toeplitz, + PropertyTypes.TotNonNeg => :totnonneg, + PropertyTypes.TotPos => :totpos, + PropertyTypes.Triangular => :triangular, + PropertyTypes.Tridiagonal => :tridiagonal, + PropertyTypes.Unimodular => :unimodular ) ) diff --git a/src/types.jl b/src/types.jl index 0e83701..fd9f7ca 100644 --- a/src/types.jl +++ b/src/types.jl @@ -17,196 +17,158 @@ TypedMatrices.PropertyTypes.Symmetric ``` """ module PropertyTypes - """ This is an abstract type for properties. """ abstract type AbstractProperty end - """ -The matrix is symmetric for some parameter values. +The matrix is bidiagonal (eigher upper or lower).. """ -struct Symmetric <: AbstractProperty end - +struct Bidiagonal <: AbstractProperty end """ -The inverse of the matrix is known explicitly. +The matrix has binary entries. """ -struct Inverse <: AbstractProperty end - +struct Binary <: AbstractProperty end """ -The matrix is a Involutory matrix. +The matrix is a Circulant matrix. """ -struct Involutory <: AbstractProperty end - +struct Circulant <: AbstractProperty end """ -The matrix has integer entries. +The matrix has complex entries. """ -struct Integer <: AbstractProperty end - +struct Complex <: AbstractProperty end """ -The matrix is ill-conditioned for some parameter values. +Correlation """ -struct IllCond <: AbstractProperty end - +struct Correlation <: AbstractProperty end """ -The matrix is positive definite for some parameter values. +Defective """ -struct PosDef <: AbstractProperty end - +struct Defective <: AbstractProperty end """ -Correlation +DiagDom """ -struct Correlation <: AbstractProperty end - +struct DiagDom <: AbstractProperty end """ Part of the eigensystem of the matrix is explicitly known. """ struct Eigen <: AbstractProperty end - """ -The matrix is sparse. +The matrix has a fixed size. """ -struct Sparse <: AbstractProperty end - +struct FixedSize <: AbstractProperty end """ -The matrix has random entries. +An adjacency matrix of a graph. """ -struct Random <: AbstractProperty end - +struct Graph <: AbstractProperty end """ -The output is a test problem for Regularization Methods. +The matrix is a Hankel matrix. """ -struct RegProb <: AbstractProperty end - +struct Hankel <: AbstractProperty end """ -An adjacency matrix of a graph. +The matrix is a Hessenberg matrix. """ -struct Graph <: AbstractProperty end - +struct Hessenberg <: AbstractProperty end """ -TotNonNeg +The matrix is ill-conditioned for some parameter values. """ -struct TotNonNeg <: AbstractProperty end - +struct IllCond <: AbstractProperty end """ -TotPos +The matrix is indefinite for some parameter values. """ -struct TotPos <: AbstractProperty end - +struct Indefinite <: AbstractProperty end """ InfDiv """ struct InfDiv <: AbstractProperty end - """ -The matrix is indefinite for some parameter values. +The matrix has integer entries. """ -struct Indefinite <: AbstractProperty end - +struct Integer <: AbstractProperty end """ -Defective +The inverse of the matrix is known explicitly. """ -struct Defective <: AbstractProperty end - +struct Inverse <: AbstractProperty end """ -Nilpotent +The matrix is a Involutory matrix. """ -struct Nilpotent <: AbstractProperty end - +struct Involutory <: AbstractProperty end """ -The matrix is a Hessenberg matrix. +Nilpotent """ -struct Hessenberg <: AbstractProperty end - +struct Nilpotent <: AbstractProperty end """ -The matrix is a Toeplitz matrix. +Nonneg """ -struct Toeplitz <: AbstractProperty end - +struct NonNeg <: AbstractProperty end """ -The matrix has binary entries. +Normal """ -struct Binary <: AbstractProperty end - +struct Normal <: AbstractProperty end """ -RankDef +The matrix is orthogonal for some parameter values. """ -struct RankDef <: AbstractProperty end - +struct Orthogonal <: AbstractProperty end """ -The matrix is a Circulant matrix. +The matrix is positive for some parameter values. """ -struct Circulant <: AbstractProperty end - +struct Positive <: AbstractProperty end """ -Normal +The matrix is positive definite for some parameter values. """ -struct Normal <: AbstractProperty end - +struct PosDef <: AbstractProperty end """ -The matrix is orthogonal for some parameter values. +The matrix has random entries. """ -struct Orthogonal <: AbstractProperty end - +struct Random <: AbstractProperty end """ -The matrix is bidiagonal (eigher upper or lower). +RankDef """ -struct Bidiagonal <: AbstractProperty end - +struct RankDef <: AbstractProperty end """ -The matrix is tridiagonal. +The matrix is rectangular. """ -struct Tridiagonal <: AbstractProperty end - +struct Rectangular <: AbstractProperty end """ -The matrix is triangular (eigher upper or lower). +The output is a test problem for Regularization Methods. """ -struct Triangular <: AbstractProperty end - +struct RegProb <: AbstractProperty end """ SingVal """ struct SingVal <: AbstractProperty end - """ -The matrix is rectangular. +The matrix is sparse. """ -struct Rectangular <: AbstractProperty end - +struct Sparse <: AbstractProperty end """ -The matrix is a Hankel matrix. +The matrix is symmetric for some parameter values. """ -struct Hankel <: AbstractProperty end - +struct Symmetric <: AbstractProperty end """ -DiagDom +The matrix is triangular (eigher upper or lower). """ -struct DiagDom <: AbstractProperty end - +struct Triangular <: AbstractProperty end """ -NonNeg +The matrix is tridiagonal. """ -struct NonNeg <: AbstractProperty end - +struct Tridiagonal <: AbstractProperty end """ -Unimodular +The matrix is a Toeplitz matrix. """ -struct Unimodular <: AbstractProperty end - +struct Toeplitz <: AbstractProperty end """ -The matrix is positive for some parameter values. +TotNonNeg """ -struct Positive <: AbstractProperty end - +struct TotNonNeg <: AbstractProperty end """ -The matrix has a fixed size. +TotPos """ -struct FixedSize <: AbstractProperty end - +struct TotPos <: AbstractProperty end """ -The matrix has complex entries. +Unimodular """ -struct Complex <: AbstractProperty end +struct Unimodular <: AbstractProperty end end """ From d0f0aac9eed02d9833337c4c1b272ed30b210e4a Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Tue, 10 Sep 2024 08:49:48 +0100 Subject: [PATCH 03/17] test(matrices): refactor `test_linear_algebra_functions` --- test/runtests.jl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index d9f237c..83ec762 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -24,21 +24,21 @@ function test_linear_algebra_functions(A::AbstractMatrix) results = Dict{Function,Bool}() # linear algebra functions - @try_catch results[isdiag] = isdiag(A) == isdiag(matrix) - @try_catch results[ishermitian] = ishermitian(A) == ishermitian(matrix) - @try_catch results[issymmetric] = issymmetric(A) == issymmetric(matrix) - @try_catch results[adjoint] = adjoint(A) ≈ adjoint(matrix) - @try_catch results[transpose] = transpose(A) ≈ transpose(matrix) - @try_catch results[det] = det(A) ≈ determinant - @try_catch results[eigvals] = eigvals(A) ≈ eigvals(matrix) - + property_functions = [isdiag, ishermitian, issymmetric] # https://github.com/JuliaLang/julia/issues/55404 if VERSION >= v"1.10" - @try_catch results[isposdef] = isposdef(A) == isposdef(matrix) + append!(property_functions, [isposdef]) + end + for func in property_functions + @try_catch results[func] = func(A) == func(matrix) + end - if determinant != 0 - @try_catch results[inv] = inv(A) ≈ inv(matrix) - end + computation_functions = [adjoint, transpose, det, eigvals] + if determinant != 0 + append!(computation_functions, [inv]) + end + for func in property_functions + @try_catch results[func] = func(A) ≈ func(matrix) end if all(values(results)) From ee3706d44d887da8d0d23962e055d08b53b26a0c Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Fri, 13 Sep 2024 22:11:21 +0100 Subject: [PATCH 04/17] docs(core): update property types docs --- src/types.jl | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/types.jl b/src/types.jl index fd9f7ca..a1bd35f 100644 --- a/src/types.jl +++ b/src/types.jl @@ -22,15 +22,15 @@ This is an abstract type for properties. """ abstract type AbstractProperty end """ -The matrix is bidiagonal (eigher upper or lower).. +The matrix is upper or lower bidiagonal. """ struct Bidiagonal <: AbstractProperty end """ -The matrix has binary entries. +The matrix has entries from a binary set. """ struct Binary <: AbstractProperty end """ -The matrix is a Circulant matrix. +The matrix is circulant. """ struct Circulant <: AbstractProperty end """ @@ -38,15 +38,15 @@ The matrix has complex entries. """ struct Complex <: AbstractProperty end """ -Correlation +The matrix is a correlation matrix. """ struct Correlation <: AbstractProperty end """ -Defective +The matrix is defective. """ struct Defective <: AbstractProperty end """ -DiagDom +The matrix is diagonally dominant. """ struct DiagDom <: AbstractProperty end """ @@ -54,11 +54,11 @@ Part of the eigensystem of the matrix is explicitly known. """ struct Eigen <: AbstractProperty end """ -The matrix has a fixed size. +The matrix is only available in some fixed sizes. """ struct FixedSize <: AbstractProperty end """ -An adjacency matrix of a graph. +The matrix is the adjacency matrix of a graph. """ struct Graph <: AbstractProperty end """ @@ -66,7 +66,7 @@ The matrix is a Hankel matrix. """ struct Hankel <: AbstractProperty end """ -The matrix is a Hessenberg matrix. +The matrix is an upper or lower Hessenberg matrix. """ struct Hessenberg <: AbstractProperty end """ @@ -78,7 +78,7 @@ The matrix is indefinite for some parameter values. """ struct Indefinite <: AbstractProperty end """ -InfDiv +The matrix is infinitely divisible. """ struct InfDiv <: AbstractProperty end """ @@ -90,19 +90,19 @@ The inverse of the matrix is known explicitly. """ struct Inverse <: AbstractProperty end """ -The matrix is a Involutory matrix. +The matrix is involutory for some parameter values. """ struct Involutory <: AbstractProperty end """ -Nilpotent +The matrix is nilpotent for some parameter values. """ struct Nilpotent <: AbstractProperty end """ -Nonneg +The matrix is nonnegative for some parameter values. """ struct NonNeg <: AbstractProperty end """ -Normal +The matrix is normal. """ struct Normal <: AbstractProperty end """ @@ -122,19 +122,19 @@ The matrix has random entries. """ struct Random <: AbstractProperty end """ -RankDef +The matrix is rank deficient. """ struct RankDef <: AbstractProperty end """ -The matrix is rectangular. +The matrix is rectangular for some parameter values. """ struct Rectangular <: AbstractProperty end """ -The output is a test problem for Regularization Methods. +The output is a test problem for regularization methods. """ struct RegProb <: AbstractProperty end """ -SingVal +Part of the singular values and vectors of the matrix is explicitly known. """ struct SingVal <: AbstractProperty end """ @@ -146,7 +146,7 @@ The matrix is symmetric for some parameter values. """ struct Symmetric <: AbstractProperty end """ -The matrix is triangular (eigher upper or lower). +The matrix is upper or lower trinagular. """ struct Triangular <: AbstractProperty end """ @@ -154,19 +154,19 @@ The matrix is tridiagonal. """ struct Tridiagonal <: AbstractProperty end """ -The matrix is a Toeplitz matrix. +The matrix is Toeplitz. """ struct Toeplitz <: AbstractProperty end """ -TotNonNeg +The matrix is totally nonnegative for some parameter values. """ struct TotNonNeg <: AbstractProperty end """ -TotPos +The matrix is totally positive for some parameter values. """ struct TotPos <: AbstractProperty end """ -Unimodular +The matrix is unimodular for some parameter values. """ struct Unimodular <: AbstractProperty end end From 91cc588be9dd96b3c2c10eb78b49abeebc2dc707 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Thu, 19 Sep 2024 16:33:14 +0100 Subject: [PATCH 05/17] docs(matrices): fix references and add DOIs --- src/matrices/binomial.jl | 5 +++-- src/matrices/cauchy.jl | 5 +++-- src/matrices/chebspec.jl | 3 ++- src/matrices/chow.jl | 3 ++- src/matrices/clement.jl | 5 +++-- src/matrices/companion.jl | 7 ++++++- src/matrices/comparison.jl | 4 ++++ src/matrices/dingdong.jl | 6 +++--- src/matrices/fiedler.jl | 6 +++--- src/matrices/frank.jl | 7 ++++--- src/matrices/gearmat.jl | 5 +++++ src/matrices/golub.jl | 6 +++--- src/matrices/grcar.jl | 6 +++--- src/matrices/hadamard.jl | 5 +++-- src/matrices/hilbert.jl | 5 +++-- src/matrices/inversehilbert.jl | 7 ++++--- src/matrices/involutory.jl | 6 +++--- src/matrices/kahan.jl | 4 ++-- src/matrices/kms.jl | 9 ++++++--- src/matrices/lehmer.jl | 13 ++++++++----- src/matrices/lotkin.jl | 3 ++- src/matrices/minij.jl | 6 +++--- src/matrices/moler.jl | 4 ++-- src/matrices/neumann.jl | 4 ++-- src/matrices/oscillate.jl | 6 +++--- src/matrices/parter.jl | 9 +++++---- src/matrices/pascal.jl | 2 +- src/matrices/pei.jl | 2 +- src/matrices/poisson.jl | 4 ++-- src/matrices/prolate.jl | 4 ++-- src/matrices/randsvd.jl | 2 +- src/matrices/rohess.jl | 5 +++-- src/matrices/rosser.jl | 7 +++---- src/matrices/sampling.jl | 6 +++--- src/matrices/triw.jl | 6 +++--- src/matrices/wathen.jl | 6 +++--- src/matrices/wilkinson.jl | 7 ++++--- 37 files changed, 116 insertions(+), 84 deletions(-) diff --git a/src/matrices/binomial.jl b/src/matrices/binomial.jl index 9a24dee..88baefb 100644 --- a/src/matrices/binomial.jl +++ b/src/matrices/binomial.jl @@ -7,8 +7,9 @@ The matrix is a multiple of an involutory matrix. - dim: the dimension of the matrix. # References -**G. Boyd, C.A. Micchelli, G. Strang and D.X. Zhou**, -Binomial matrices, Adv. in Comput. Math., 14 (2001), pp 379-391. +**G. Boyd, C. A. Micchelli, G. Strang and D. X. Zhou**, +Binomial matrices, Adv. Comput. Math., 14 (2001), pp. 379-391, +https://doi.org/10.1023/A:1012207124894. """ struct Binomial{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/cauchy.jl b/src/matrices/cauchy.jl index f1490c8..e208629 100644 --- a/src/matrices/cauchy.jl +++ b/src/matrices/cauchy.jl @@ -12,8 +12,9 @@ Given two vectors `x` and `y`, the `(i,j)` entry of the Cauchy matrix is # References **N. J. Higham**, Accuracy and Stability of Numerical Algorithms, -second edition, Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, -2002; sec. 28.1 +second edition, Society for Industrial and Applied Mathematics, +Philadelphia, PA, USA, 2002, https://doi.org/10.1137/1.9780898718027. +See sect. 28.1. """ struct Cauchy{T<:Number,X<:AbstractVector,Y<:AbstractVector} <: AbstractMatrix{T} x::X diff --git a/src/matrices/chebspec.jl b/src/matrices/chebspec.jl index 6998d2e..401906b 100644 --- a/src/matrices/chebspec.jl +++ b/src/matrices/chebspec.jl @@ -13,7 +13,8 @@ If `k = 0`,the generated matrix is nilpotent and a vector with # References **L. N. Trefethen and M. R. Trummer**, An instability - phenomenon in spectral methods, SIAM J. Numer. Anal., 24 (1987), pp. 1008-1023. +phenomenon in spectral methods, SIAM J. Numer. Anal., 24 (1987), +pp. 1008-1023, https://doi.org/10.1137/0724066. """ struct ChebSpec{T<:Number} <: AbstractMatrix{T} n::Int diff --git a/src/matrices/chow.jl b/src/matrices/chow.jl index 852d79a..e58bd74 100644 --- a/src/matrices/chow.jl +++ b/src/matrices/chow.jl @@ -11,7 +11,8 @@ The Chow matrix is a singular Toeplitz lower Hessenberg matrix. # References **T. S. Chow**, A class of Hessenberg matrices with known - eigenvalues and inverses, SIAM Review, 11 (1969), pp. 391-395. +eigenvalues and inverses, SIAM Rev., 11 (1969), pp. 391-395, +https://doi.org/10.1137/1011065. """ struct Chow{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/clement.jl b/src/matrices/clement.jl index aa4da7b..cc64d1c 100644 --- a/src/matrices/clement.jl +++ b/src/matrices/clement.jl @@ -11,8 +11,9 @@ The Clement matrix is a tridiagonal matrix with zero - dim: `k = 0`. # References -**P. A. Clement**, A class of triple-diagonal - matrices for test purposes, SIAM Review, 1 (1959), pp. 50-52. +**P. A. Clement**, A class of triple-diagonal matrices +for test purposes, SIAM Rev., 1 (1959), pp. 50-52, +https://doi.org/10.1137/1001006. """ abstract type Clement{T<:Number} <: AbstractMatrix{T} end diff --git a/src/matrices/companion.jl b/src/matrices/companion.jl index de13d2c..f95c0b5 100644 --- a/src/matrices/companion.jl +++ b/src/matrices/companion.jl @@ -11,7 +11,12 @@ The companion matrix to a monic polynomial # Input Options - vec: `vec` is a vector of coefficients. - dim: `vec = [1:dim;]`. `dim` is the dimension of the matrix. -- polynomial: `polynomial` is a polynomial. vector will be appropriate values from coefficients. +- polynomial: `polynomial` is a polynomial. Last column will contain +its coefficients. + +# References +**N. J. Higham**, What Is the Companion Matrix?, +https://nhigham.com/2021/03/23/what-is-a-companion-matrix/ """ struct Companion{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/comparison.jl b/src/matrices/comparison.jl index d9b1f74..8a846e2 100644 --- a/src/matrices/comparison.jl +++ b/src/matrices/comparison.jl @@ -8,6 +8,10 @@ The comparison matrix for another matrix. `k = 0`: each element is absolute value of `B`, except each diagonal element is negative absolute value. `k = 1`: each diagonal element is absolute value of `B`, except each off-diagonal element is negative largest absolute value in the same row. - B: `B` is a matrix and `k = 1`. + +**N. J. Higham**, Efficient algorithms for computing the condition number +of a tridiagonal matrix, SIAM J. Sci. Stat. Comput., 7 (1986), pp. 150-165, +https://doi.org/10.1137/0907011. """ struct Comparison{T<:Number} <: AbstractMatrix{T} A::AbstractMatrix{T} diff --git a/src/matrices/dingdong.jl b/src/matrices/dingdong.jl index f225fe2..2ed147d 100644 --- a/src/matrices/dingdong.jl +++ b/src/matrices/dingdong.jl @@ -9,9 +9,9 @@ The eigenvalues cluster around `π/2` and `-π/2`. - dim: the dimension of the matrix. # References -**J. C. Nash**, Compact Numerical Methods for -Computers: Linear Algebra and Function Minimisation, -second edition, Adam Hilger, Bristol, 1990 (Appendix 1). +**J. C. Nash**, Compact Numerical Methods for Computers: +Linear Algebra and Function Minimisation, second edition, +Adam Hilger, Bristol, 1990 (Appendix 1). """ struct DingDong{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/fiedler.jl b/src/matrices/fiedler.jl index 4e62aea..45a380b 100644 --- a/src/matrices/fiedler.jl +++ b/src/matrices/fiedler.jl @@ -9,11 +9,11 @@ The Fiedler matrix is symmetric matrix with a dominant - dim: `dim` is the dimension of the matrix. `vec=[1:dim;]`. # References -**G. Szego**, Solution to problem 3705, Amer. Math. - Monthly, 43 (1936), pp. 246-259. +**A. C. Schaeffer and G. Szegö**, Solution to problem 3705, Amer. Math. Monthly, +43 (1936), pp. 246-259, https://doi.org/10.1090/S0002-9947-1941-0005164-7. **J. Todd**, Basic Numerical Mathematics, Vol. 2: Numerical Algebra, - Birkhauser, Basel, and Academic Press, New York, 1977, p. 159. +Birkhauser, Basel, and Academic Press, New York, 1977, p. 159. """ struct Fiedler{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/frank.jl b/src/matrices/frank.jl index ff781c6..e3ba397 100644 --- a/src/matrices/frank.jl +++ b/src/matrices/frank.jl @@ -11,9 +11,10 @@ very ill conditioned. - dim: the dimension of the matrix. # References -**W. L. Frank**, Computing eigenvalues of complex matrices - by determinant evaluation and by methods of Danilewski and Wielandt, - J. Soc. Indust. Appl. Math., 6 (1958), pp. 378-392 (see pp. 385, 388). +**W. L. Frank**, Computing eigenvalues of complex matrices by determinant +evaluation and by methods of Danilewski and Wielandt, J. Soc. Indust. +Appl. Math., 6 (1958), pp. 378-392, https://doi.org/10.1137/0106026. +See pp. 385 and 388. """ struct Frank{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/gearmat.jl b/src/matrices/gearmat.jl index e2189ce..d0258e7 100644 --- a/src/matrices/gearmat.jl +++ b/src/matrices/gearmat.jl @@ -8,6 +8,11 @@ other elements are 0. # Input Options - dim: the dimension of the matrix. `i = n` and `j = -n` by default. - dim, i, j: the dimension of the matrix and the position of the 1's. + +# References +**C. W. Gear**, A simple set of test matrices for eigenvalue programs, +Math. Comp., 23 (1969), pp. 119-125, +https://doi.org/10.1090/S0025-5718-1969-0238477-8. """ struct GearMat{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/golub.jl b/src/matrices/golub.jl index d174f2a..f423481 100644 --- a/src/matrices/golub.jl +++ b/src/matrices/golub.jl @@ -9,9 +9,9 @@ Golub matrix is the product of two random unit lower and upper - dim: the dimension of the matrix. # References -**D. Viswanath and N. Trefethen**. Condition Numbers of - Random Triangular Matrices, SIAM J. Matrix Anal. Appl. 19, 564-581, - 1998. +**D. Viswanath and N. Trefethen**. Condition numbers of random +triangular matrices, SIAM J. Matrix Anal. Appl., 19 (1998), 564-581, +https://doi.org/10.1137/S0895479896312869. """ struct Golub{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/grcar.jl b/src/matrices/grcar.jl index 87ddf9e..f79974d 100644 --- a/src/matrices/grcar.jl +++ b/src/matrices/grcar.jl @@ -10,9 +10,9 @@ eigenvalues. - dim: the dimension of the matrix. # References -**J. F. Grcar**, Operator coefficient methods - for linear equations, Report SAND89-8691, Sandia National - Laboratories, Albuquerque, New Mexico, 1989 (Appendix 2). +**J. F. Grcar**, Operator coefficient methods for linear equations, +Report SAND89-8691, Sandia National Laboratories, Albuquerque, +New Mexico, 1989 (Appendix 2). """ struct Grcar{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/hadamard.jl b/src/matrices/hadamard.jl index c940d4f..3f4f927 100644 --- a/src/matrices/hadamard.jl +++ b/src/matrices/hadamard.jl @@ -9,8 +9,9 @@ a Hadamard matrix are orthogonal. - dim: the dimension of the matrix, `dim` is a power of 2. # References -**S. W. Golomb and L. D. Baumert**, The search for -Hadamard matrices, Amer. Math. Monthly, 70 (1963) pp. 12-17 +**S. W. Golomb and L. D. Baumert**, The search for Hadamard +matrices, Amer. Math. Monthly, 70 (1963) pp. 12-17, +https://doi.org/10.1080/00029890.1963.11990035. """ struct Hadamard{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/hilbert.jl b/src/matrices/hilbert.jl index eb6c463..1c2bba8 100644 --- a/src/matrices/hilbert.jl +++ b/src/matrices/hilbert.jl @@ -13,11 +13,12 @@ See also [`InverseHilbert`](@ref). # References **M. D. Choi**, Tricks or treats with the Hilbert matrix, -Amer. Math. Monthly, 90 (1983), pp. 301-312. +Amer. Math. Monthly, 90 (1983), pp. 301-312, +https://doi.org/10.1080/00029890.1983.11971218. **N. J. Higham**, Accuracy and Stability of Numerical Algorithms, second edition, Society for Industrial and Applied Mathematics, -Philadelphia, PA, USA, 2002; sec. 28.1. +Philadelphia, PA, USA, 2002. See sect. 28.1. """ struct Hilbert{T<:Number} <: AbstractMatrix{T} m::Integer diff --git a/src/matrices/inversehilbert.jl b/src/matrices/inversehilbert.jl index 539b1dc..3cedce2 100644 --- a/src/matrices/inversehilbert.jl +++ b/src/matrices/inversehilbert.jl @@ -9,11 +9,12 @@ See also [`Hilbert`](@ref). # References **M. D. Choi**, Tricks or treats with the Hilbert matrix, - Amer. Math. Monthly, 90 (1983), pp. 301-312. +Amer. Math. Monthly, 90 (1983), pp. 301-312, +https://doi.org/10.1080/00029890.1983.11971218. **N. J. Higham**, Accuracy and Stability of Numerical Algorithms, second - edition, Society for Industrial and Applied Mathematics, Philadelphia, PA, - USA, 2002; sec. 28.1. +edition, Society for Industrial and Applied Mathematics, Philadelphia, PA, +USA, 2002. See sect. 28.1. """ struct InverseHilbert{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/involutory.jl b/src/matrices/involutory.jl index 0335f73..1d35dcf 100644 --- a/src/matrices/involutory.jl +++ b/src/matrices/involutory.jl @@ -7,9 +7,9 @@ An involutory matrix is a matrix that is its own inverse. - dim: `dim` is the dimension of the matrix. # References -**A. S. Householder and J. A. Carpenter**, The - singular values of involutory and of idempotent matrices, - Numer. Math. 5 (1963), pp. 234-237. +**A. S. Householder and J. A. Carpenter**, The singular values +of involutory and of idempotent matrices, Numer. Math. 5 (1963), +pp. 234-237, https://doi.org/10.1007/BF01385894. """ struct Involutory{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/kahan.jl b/src/matrices/kahan.jl index fd9681f..08f6e81 100644 --- a/src/matrices/kahan.jl +++ b/src/matrices/kahan.jl @@ -13,8 +13,8 @@ The Kahan matrix is an upper trapezoidal matrix, i.e., the - dim: `θ = 1.2`, `pert = 25`. # References -**W. Kahan**, Numerical linear algebra, Canadian Math. - Bulletin, 9 (1966), pp. 757-801. +**W. Kahan**, Numerical linear algebra, Canadian Math. Bulletin, +9 (1966), pp. 757-801, https://doi.org/10.4153/CMB-1966-083-2. """ struct Kahan{T<:Number} <: AbstractMatrix{T} m::Integer diff --git a/src/matrices/kms.jl b/src/matrices/kms.jl index d00e8ac..a9daae0 100644 --- a/src/matrices/kms.jl +++ b/src/matrices/kms.jl @@ -8,9 +8,12 @@ Kac-Murdock-Szego Toeplitz matrix - dim: `rho = 0.5`. # References -**W. F. Trench**, Numerical solution of the eigenvalue - problem for Hermitian Toeplitz matrices, SIAM J. Matrix Analysis - and Appl., 10 (1989), pp. 135-146 (and see the references therein). +**W. F. Trench**, Numerical solution of the eigenvalue problem for Hermitian +Toeplitz matrices, SIAM J. Matrix Anal. Appl., 10 (1989), pp. 135-146, +https://doi.org/10.1137/0610010. + +**N. J. Higham**, What Is the Kac-Murdock-Szegö Matrix?, +https://nhigham.com/2021/07/06/what-is-the-kac-murdock-szego-matrix/ """ struct KMS{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/lehmer.jl b/src/matrices/lehmer.jl index e083835..397fd76 100644 --- a/src/matrices/lehmer.jl +++ b/src/matrices/lehmer.jl @@ -9,11 +9,14 @@ The Lehmer matrix is a symmetric positive definite matrix. - dim: the dimension of the matrix. # References -**M. Newman and J. Todd**, The evaluation of - matrix inversion programs, J. Soc. Indust. Appl. Math., - 6 (1958), pp. 466-476. - Solutions to problem E710 (proposed by D.H. Lehmer): The inverse - of a matrix, Amer. Math. Monthly, 53 (1946), pp. 534-535. +**M. Newman and J. Todd**, The evaluation of matrix inversion programs, +J. Soc. Indust. Appl. Math., 6 (1958), pp. 466-476, https://doi.org/10.1137/0106030. + +**D. H. Lehmer**, Problem E710: The inverse of a matrix, +Amer. Math. Monthly, 53 (1946), p. 97, https://doi.org/10.2307/2305463. + +Solutions by D. M. Smiley and M. F. Smiley, and by John Williamson. +Amer. Math. Monthly, 53 (1946), pp. 534-535, https://doi.org/10.2307/2305078. """ struct Lehmer{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/lotkin.jl b/src/matrices/lotkin.jl index 7a7a43f..1069728 100644 --- a/src/matrices/lotkin.jl +++ b/src/matrices/lotkin.jl @@ -9,7 +9,8 @@ The Lotkin matrix is the Hilbert matrix with its first row - dim: `dim` is the dimension of the matrix. # References -**M. Lotkin**, A set of test matrices, MTAC, 9 (1955), pp. 153-161. +**M. Lotkin**, A set of test matrices, Math. Tables Aid Comput., +9 (1955), pp. 153-161, https://doi.org/10.2307/2002051. """ struct Lotkin{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/minij.jl b/src/matrices/minij.jl index e5261b9..013061a 100644 --- a/src/matrices/minij.jl +++ b/src/matrices/minij.jl @@ -9,9 +9,9 @@ A matrix with `(i,j)` entry `min(i,j)`. It is a symmetric positive - dim: the dimension of the matrix. # References -**J. Fortiana and C. M. Cuadras**, A family of matrices, - the discretized Brownian bridge, and distance-based regression, - Linear Algebra Appl., 264 (1997), 173-188. (For the eigensystem of A.) +**J. Fortiana and C. M. Cuadras**, A family of matrices, the discretized +Brownian bridge, and distance-based regression, Linear Algebra Appl., +264 (1997), pp. 173-188, https://doi.org/10.1016/S0024-3795(97)00051-7. """ struct Minij{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/moler.jl b/src/matrices/moler.jl index d157177..e1e4764 100644 --- a/src/matrices/moler.jl +++ b/src/matrices/moler.jl @@ -11,8 +11,8 @@ It has one small eigenvalue. # References **J.C. Nash**, Compact Numerical Methods for Computers: - Linear Algebra and Function Minimisation, second edition, - Adam Hilger, Bristol, 1990 (Appendix 1). +Linear Algebra and Function Minimisation, second edition, +Adam Hilger, Bristol, 1990 (Appendix 1). """ struct Moler{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/neumann.jl b/src/matrices/neumann.jl index e20f546..c49545f 100644 --- a/src/matrices/neumann.jl +++ b/src/matrices/neumann.jl @@ -8,8 +8,8 @@ A singular matrix from the discrete Neumann problem. - dim: the dimension of the matrix, must be a perfect square integer. # References -**R. J. Plemmons**, Regular splittings and the - discrete Neumann problem, Numer. Math., 25 (1976), pp. 153-161. +**R. J. Plemmons**, Regular splittings and the discrete Neumann problem, +Numer. Math., 25 (1976), pp. 153-161, https://doi.org/10.1007/BF01462269. """ struct Neumann{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/oscillate.jl b/src/matrices/oscillate.jl index c1bd630..5d65d52 100644 --- a/src/matrices/oscillate.jl +++ b/src/matrices/oscillate.jl @@ -13,9 +13,9 @@ A matrix `A` is called oscillating if `A` is totally - dim: `mode = 1`. # References -**Per Christian Hansen**, Test matrices for - regularization methods. SIAM J. SCI. COMPUT Vol 16, - No2, pp 506-512 (1995). +**P. C. Hansen**, Test matrices for regularization methods, SIAM J. +Sci. Comput., 16 (1995), pp. 506-512, https://doi.org/10.1137/0916032. +. """ struct Oscillate{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/parter.jl b/src/matrices/parter.jl index 3bb6294..f66d39e 100644 --- a/src/matrices/parter.jl +++ b/src/matrices/parter.jl @@ -8,10 +8,11 @@ The Parter matrix is a Toeplitz and Cauchy matrix - dim: the dimension of the matrix. # References -The MathWorks Newsletter, Volume 1, Issue 1, - March 1986, page 2. S. V. Parter, On the distribution of the - singular values of Toeplitz matrices, Linear Algebra and - Appl., 80 (1986), pp. 115-130. +The MathWorks Newsletter, Volume 1, Issue 1, March 1986, page 2. + +**S. V. Parter**, On the distribution of the singular values of +Toeplitz matrices, Linear Algebra Appl., 80 (1986), pp. 115-130, +https://doi.org/10.1016/0024-3795(86)90280-6. """ struct Parter{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/pascal.jl b/src/matrices/pascal.jl index 5324fed..5016f6e 100644 --- a/src/matrices/pascal.jl +++ b/src/matrices/pascal.jl @@ -14,7 +14,7 @@ The Pascal matrix’s anti-diagonals form the Pascal’s triangle. **N. J. Higham**, Accuracy and Stability of Numerical Algorithms, second edition, Society for Industrial and Applied Mathematics, Philadelphia, PA, -USA, 2002; sec. 28.4. +USA, 2002. See sect. 28.4. """ struct Pascal{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/pei.jl b/src/matrices/pei.jl index 7f02ead..865db47 100644 --- a/src/matrices/pei.jl +++ b/src/matrices/pei.jl @@ -10,7 +10,7 @@ The Pei matrix is a symmetric matrix with known inversion. # References **M. L. Pei**, A test matrix for inversion procedures, - Comm. ACM, 5 (1962), p. 508. +Comm. ACM, 5 (1962), p. 508, https://doi.org/10.1145/368959.368975. """ struct Pei{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/poisson.jl b/src/matrices/poisson.jl index 88b7860..fc045b5 100644 --- a/src/matrices/poisson.jl +++ b/src/matrices/poisson.jl @@ -10,8 +10,8 @@ A block tridiagonal matrix from Poisson’s equation. # References **G. H. Golub and C. F. Van Loan**, Matrix Computations, - second edition, Johns Hopkins University Press, Baltimore, - Maryland, 1989 (Section 4.5.4). +second edition, Johns Hopkins University Press, Baltimore, +Maryland, 1989. See sect. 4.5.4. """ struct Poisson{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/prolate.jl b/src/matrices/prolate.jl index beb75ee..9e340df 100644 --- a/src/matrices/prolate.jl +++ b/src/matrices/prolate.jl @@ -8,8 +8,8 @@ A prolate matrix is a symmetirc, ill-conditioned Toeplitz matrix. - dim: the case when `w = 0.25`. # References -**J. M. Varah**. The Prolate Matrix. Linear Algebra and Appl. - 187:267--278, 1993. +**J. M. Varah**. The Prolate matrix. Linear Algebra Appl., 187 (1993), +pp. 267-278, https://doi.org/10.1016/0024-3795(93)90142-B. """ struct Prolate{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/randsvd.jl b/src/matrices/randsvd.jl index 4f2f008..f39e4c6 100644 --- a/src/matrices/randsvd.jl +++ b/src/matrices/randsvd.jl @@ -17,7 +17,7 @@ Random Matrix with Pre-assigned Singular Values # References **N. J. Higham**, Accuracy and Stability of Numerical Algorithms, second edition, Society for Industrial and Applied Mathematics, -Philadelphia, PA, USA, 2002; sec. 28.3. +Philadelphia, PA, USA, 2002. See sect. 28.3. """ struct RandSVD{T<:Number} <: AbstractMatrix{T} m::Integer diff --git a/src/matrices/rohess.jl b/src/matrices/rohess.jl index 36447dc..1ea35b2 100644 --- a/src/matrices/rohess.jl +++ b/src/matrices/rohess.jl @@ -7,8 +7,9 @@ The matrix is constructed via a product of Givens rotations. - dim: the dimension of the matrix. # References -**W. B. Gragg**, The QR algorithm for unitary - Hessenberg matrices, J. Comp. Appl. Math., 16 (1986), pp. 1-8. +**W. B. Gragg**, The QR algorithm for unitary Hessenberg matrices, +J. Comp. Appl. Math., 16 (1986), pp. 1-8, +https://doi.org/10.1016/0377-0427(86)90169-X. """ struct Rohess{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/rosser.jl b/src/matrices/rosser.jl index df901c4..1d4f0ec 100644 --- a/src/matrices/rosser.jl +++ b/src/matrices/rosser.jl @@ -21,10 +21,9 @@ The Rosser matrix’s eigenvalues are very close together - dim: `a = rand(1:5), b = rand(1:5)`. # References -**J. B. Rosser, C. Lanczos, M. R. Hestenes, W. Karush**, - Separation of close eigenvalues of a real symmetric matrix, - Journal of Research of the National Bureau of Standards, v(47) - (1951) +**J. B. Rosser, C. Lanczos, M. R. Hestenes, and W. Karush**, +Separation of close eigenvalues of a real symmetric matrix, +J. Research National Bureau Standards, 47 (1951), pp. 291-297. """ struct Rosser{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/sampling.jl b/src/matrices/sampling.jl index 9c9cb8d..1df324e 100644 --- a/src/matrices/sampling.jl +++ b/src/matrices/sampling.jl @@ -9,9 +9,9 @@ A nonsymmetric matrix with eigenvalues 0, 1, 2, ... n-1. `vec = [1:dim;]/dim`. # References -**L. Bondesson and I. Traat**, A nonsymmetric matrix - with integer eigenvalues, linear and multilinear algebra, 55(3) - (2007), pp. 239-247 +**L. Bondesson and I. Traat**, A nonsymmetric matrix with integer +eigenvalues, Linear Multilinear Algebra, 55 (2007), pp. 239-247, +https://doi.org/10.1080/03081080600906455. """ struct Sampling{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/triw.jl b/src/matrices/triw.jl index 9e9df01..ae70b49 100644 --- a/src/matrices/triw.jl +++ b/src/matrices/triw.jl @@ -11,9 +11,9 @@ Upper triangular matrices discussed by Wilkinson and others. - dim: the dimension of the matrix. # References -**G. H. Golub and J. H. Wilkinson**, Ill-conditioned -eigensystems and the computation of the Jordan canonical form, -SIAM Review, 18(4), 1976, pp. 578-6 +**G. H. Golub and J. H. Wilkinson**, Ill-conditioned eigensystems +and the computation of the Jordan canonical form, SIAM Rev., 18 +(1976), pp. 578-619, https://doi.org/10.1137/1018113. """ struct Triw{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/wathen.jl b/src/matrices/wathen.jl index bbf1aa2..37e9c83 100644 --- a/src/matrices/wathen.jl +++ b/src/matrices/wathen.jl @@ -16,9 +16,9 @@ the consistent mass matrix for a regular nx-by-ny grid of *Groups:* ["symmetric", "posdef", "eigen", "random", "sparse"] # References -**A. J. Wathen**, Realistic eigenvalue bounds for - the Galerkin mass matrix, IMA J. Numer. Anal., 7 (1987), - pp. 449-457. +**A. J. Wathen**, Realistic eigenvalue bounds for the Galerkin +mass matrix, IMA J. Numer. Anal., 7 (1987), pp. 449-457, +https://doi.org/10.1093/imanum/7.4.449. """ struct Wathen{T<:Number} <: AbstractMatrix{T} nx::Integer diff --git a/src/matrices/wilkinson.jl b/src/matrices/wilkinson.jl index 2c61975..20d849e 100644 --- a/src/matrices/wilkinson.jl +++ b/src/matrices/wilkinson.jl @@ -3,14 +3,15 @@ Wilkinson Matrix ================ The Wilkinson matrix is a symmetric tridiagonal matrix with pairs of nearly equal eigenvalues. The most frequently used case -is `matrixdepot("wilkinson", 21)`. The result is of type `Tridiagonal`. +is the matrix of size 21. # Input Options - dim: the dimension of the matrix. # References -**J. H. Wilkinson**, Error analysis of direct methods -of matrix inversion, J. Assoc. Comput. Mach., 8 (1961), pp. 281-330. +**J. H. Wilkinson**, Error analysis of direct methods of matrix +inversion, J. Assoc. Comput. Mach., 8 (1961), pp. 281-330, +https://doi.org/10.1145/321075.321076. """ struct Wilkinson{T<:Number} <: AbstractMatrix{T} n::Integer From e262fe6df29687d7761fafcbb905f218a8625d38 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Sun, 6 Oct 2024 21:41:02 +0100 Subject: [PATCH 06/17] docs(matrices): rewrite documentation and add more references --- src/matrices/binomial.jl | 2 +- src/matrices/cauchy.jl | 6 +++--- src/matrices/chebspec.jl | 12 +++++++----- src/matrices/chow.jl | 2 +- src/matrices/circulant.jl | 2 +- src/matrices/clement.jl | 2 +- src/matrices/companion.jl | 10 ++++++---- src/matrices/comparison.jl | 8 ++++---- src/matrices/cycol.jl | 4 ++-- src/matrices/dingdong.jl | 4 ++-- src/matrices/dorr.jl | 8 +++++++- src/matrices/dramadah.jl | 8 +++++++- src/matrices/fiedler.jl | 4 ++-- src/matrices/forsythe.jl | 2 +- src/matrices/frank.jl | 2 +- src/matrices/gcdmat.jl | 4 ++-- src/matrices/gearmat.jl | 10 ++++++---- src/matrices/golub.jl | 7 ++++--- src/matrices/hadamard.jl | 6 +++--- src/matrices/hankel.jl | 3 +-- src/matrices/hanowa.jl | 3 ++- src/matrices/inversehilbert.jl | 1 + src/matrices/invhess.jl | 2 +- src/matrices/ipjfact.jl | 5 +++++ src/matrices/jordbloc.jl | 3 +-- src/matrices/kahan.jl | 5 +++-- src/matrices/krylov.jl | 5 +++-- src/matrices/lauchli.jl | 5 +++++ src/matrices/lehmer.jl | 4 ++-- src/matrices/lotkin.jl | 4 ++-- src/matrices/poisson.jl | 4 ++-- src/matrices/redheff.jl | 2 +- src/matrices/smoke.jl | 3 ++- src/matrices/wathen.jl | 9 +++------ src/matrices/wilkinson.jl | 3 +-- 35 files changed, 96 insertions(+), 68 deletions(-) diff --git a/src/matrices/binomial.jl b/src/matrices/binomial.jl index 88baefb..697fd38 100644 --- a/src/matrices/binomial.jl +++ b/src/matrices/binomial.jl @@ -1,7 +1,7 @@ """ Binomial Matrix =============== -The matrix is a multiple of an involutory matrix. +The binomial matrix is a multiple of an involutory matrix. # Input Options - dim: the dimension of the matrix. diff --git a/src/matrices/cauchy.jl b/src/matrices/cauchy.jl index e208629..6331c83 100644 --- a/src/matrices/cauchy.jl +++ b/src/matrices/cauchy.jl @@ -5,10 +5,10 @@ Given two vectors `x` and `y`, the `(i,j)` entry of the Cauchy matrix is `1/(x[i]+y[j])`. # Input Options -- x: an integer, as vectors 1:x and 1:x. -- x, y: two integers, as vectors 1:x and 1:y. -- x: a vector. `y` defaults to `x`. - x, y: two vectors. +- x, y: two integers, as vectors `1:x` and `1:y``. +- x: an integer, as vectors `1:x`` and `1:x``. +- x: a vector. `y` defaults to `x`. # References **N. J. Higham**, Accuracy and Stability of Numerical Algorithms, diff --git a/src/matrices/chebspec.jl b/src/matrices/chebspec.jl index 401906b..e2346f4 100644 --- a/src/matrices/chebspec.jl +++ b/src/matrices/chebspec.jl @@ -1,14 +1,16 @@ """ Chebyshev Spectral Differentiation Matrix ========================================= +The Chebyshev Spectral Differentiation Matrix is used to approximate +numerically the derivatives of a function evaluated at Chebyshev nodes. + If `k = 0`,the generated matrix is nilpotent and a vector with - all one entries is a null vector. If `k = 1`, the generated - matrix is nonsingular and well-conditioned. Its eigenvalues - have negative real parts. +all one entries is a null vector. If `k = 1`, the generated +matrix is nonsingular and well-conditioned. Its eigenvalues +have negative real parts. # Input Options -- dim, k: `dim` is the dimension of the matrix and - `k = 0 or 1`. +- dim, k: `dim` is the dimension of the matrix and `k` is either `0` or `1`. - dim: `k=0`. # References diff --git a/src/matrices/chow.jl b/src/matrices/chow.jl index e58bd74..47ad09c 100644 --- a/src/matrices/chow.jl +++ b/src/matrices/chow.jl @@ -1,7 +1,7 @@ """ Chow Matrix =========== -The Chow matrix is a singular Toeplitz lower Hessenberg matrix. +The Chow matrix is a singular Toeplitz lower-Hessenberg matrix. # Input Options - dim, alpha, delta: `dim` is dimension of the matrix. diff --git a/src/matrices/circulant.jl b/src/matrices/circulant.jl index 05407d4..88a9865 100644 --- a/src/matrices/circulant.jl +++ b/src/matrices/circulant.jl @@ -7,7 +7,7 @@ step forward. # Input Options - vec: a vector. -- dim: an integer, as vector 1:dim. +- dim: an integer, as vector `1:dim`. # References **P. J. Davis**, Circulant Matrices, John Wiley, 1977. diff --git a/src/matrices/clement.jl b/src/matrices/clement.jl index cc64d1c..cec7583 100644 --- a/src/matrices/clement.jl +++ b/src/matrices/clement.jl @@ -2,7 +2,7 @@ Clement Matrix ============== The Clement matrix is a tridiagonal matrix with zero - diagonal entries. If k = 1, the matrix is symmetric. +diagonal entries. If k = 1, the matrix is symmetric. # Input Options - dim, k: `dim` is the dimension of the matrix. diff --git a/src/matrices/companion.jl b/src/matrices/companion.jl index f95c0b5..42d87a5 100644 --- a/src/matrices/companion.jl +++ b/src/matrices/companion.jl @@ -3,10 +3,12 @@ using Polynomials: Polynomial """ Companion Matrix ================ -The companion matrix to a monic polynomial - `a(x) = a_0 + a_1x + ... + a_{n-1}x^{n-1} + x^n` - is the n-by-n matrix with ones on the subdiagonal and - the last column given by the coefficients of `a(x)`. +The companion matrix to the monic polynomial +``` +a(x) = a_0 + a_1x + ... + a_{n-1}x^{n-1} + x^n +``` +is the `n`-by-`n` matrix with ones on the first subdiagonal and +the last column given by the coefficients of `a(x)`. # Input Options - vec: `vec` is a vector of coefficients. diff --git a/src/matrices/comparison.jl b/src/matrices/comparison.jl index 8a846e2..5110fea 100644 --- a/src/matrices/comparison.jl +++ b/src/matrices/comparison.jl @@ -1,16 +1,16 @@ """ Comparison Matrix ================= -The comparison matrix for another matrix. +The comparison matrix of a given matrix. # Input Options - B, k: `B` is a matrix. - `k = 0`: each element is absolute value of `B`, except each diagonal element is negative absolute value. - `k = 1`: each diagonal element is absolute value of `B`, except each off-diagonal element is negative largest absolute value in the same row. + If `k = 0`, then `C(i,j) = abs(B(i,j))` for `i ≠ j` and `C(i,i) = -abs(B(i,i))`. + If `k = 1`, then `C(i,i) = abs(B(i,i))` and `C(i,j) = -max(abs(B(i,:)))` for `i ≠ j`. - B: `B` is a matrix and `k = 1`. **N. J. Higham**, Efficient algorithms for computing the condition number -of a tridiagonal matrix, SIAM J. Sci. Stat. Comput., 7 (1986), pp. 150-165, +of a tridiagonal matrix, SIAM J. Sci. Stat. Comput., 7 (1986), pp. 150-165, https://doi.org/10.1137/0907011. """ struct Comparison{T<:Number} <: AbstractMatrix{T} diff --git a/src/matrices/cycol.jl b/src/matrices/cycol.jl index 1ee31dc..87b5c2f 100644 --- a/src/matrices/cycol.jl +++ b/src/matrices/cycol.jl @@ -1,10 +1,10 @@ """ Cycol Matrix ============ -The cycol matrix repeats columns. +This matrix has columns that repeat cyclically. # Input Options -- m, n, k: `m` and `n` are size of the matrix. The repetition is randn(m, k). +- m, n, k: `m` and `n` are size of the matrix. The repeated columns are randn(m, k). - n, k: `n` is size of the matrix. The repetition is randn(n, k). - n: `n` is size of the matrix. `k = round(n/4)` """ diff --git a/src/matrices/dingdong.jl b/src/matrices/dingdong.jl index 2ed147d..9ed1feb 100644 --- a/src/matrices/dingdong.jl +++ b/src/matrices/dingdong.jl @@ -1,8 +1,8 @@ """ Dingdong Matrix =============== -The Dingdong matrix is a symmetric Hankel matrix invented -by DR. F. N. Ris of IBM, Thomas J Watson Research Centre. +The Dingdong matrix is a Hankel matrix due to +F. N. Ris of IBM Thomas J. Watson Research Centre. The eigenvalues cluster around `π/2` and `-π/2`. # Input Options diff --git a/src/matrices/dorr.jl b/src/matrices/dorr.jl index 1ae7def..116d78a 100644 --- a/src/matrices/dorr.jl +++ b/src/matrices/dorr.jl @@ -1,12 +1,18 @@ """ Dorr Matrix ============ -Dorr Matrix is a diagonally dominant, illcond, tridiagonal sparse matrix. +The Dorr Matrix is a diagonally dominant, ill-conditioned, +tridiagonal sparse matrix. # Input Options - dim, theta: `dim` is the dimension of the matrix and `theta` is the parameter of the matrix. - dim: `theta = 0.01`. + +# References +**F. W. Dorr**, An example of ill-conditioning in the numerical solution +of singular perturbation problems, Math. Comp., 25 (1971), pp. 271-283, +https://doi.org/10.1090/S0025-5718-1971-0297142-0. """ abstract type Dorr{T<:Number} <: AbstractMatrix{T} end diff --git a/src/matrices/dramadah.jl b/src/matrices/dramadah.jl index 787cc94..463e8d4 100644 --- a/src/matrices/dramadah.jl +++ b/src/matrices/dramadah.jl @@ -1,7 +1,8 @@ """ Dramadah Matrix ================ -Dramadah matrix is a matrix with 0s and 1s. +The Dramadah matrix is a matrix of 0s and 1s whose inverse has +comparatively large Frobenius norm. # Input Options - dim, k: the dimension of the matrix and k. @@ -9,6 +10,11 @@ Dramadah matrix is a matrix with 0s and 1s. `k = 2` the inverse has integer entries. `k = 3` det(A) is equal to nth Fibonacci number. - dim: `k = 1`. + +# References +**R.L. Graham and N.J.A. Sloane**, Anti-Hadamard matrices, +Linear Algebra and Appl., 62 (1984), pp. 113-137. +https://doi.org/10.1016/0024-3795(84)90090-9 """ struct Dramadah{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/fiedler.jl b/src/matrices/fiedler.jl index 45a380b..f77d68b 100644 --- a/src/matrices/fiedler.jl +++ b/src/matrices/fiedler.jl @@ -1,8 +1,8 @@ """ Fiedler Matrix ============== -The Fiedler matrix is symmetric matrix with a dominant - positive eigenvalue and all the other eigenvalues are negative. +The Fiedler matrix has exactly one positive eigenvalue, the dominant one. +All the other eigenvalues are negative. # Input Options - vec: a vector. diff --git a/src/matrices/forsythe.jl b/src/matrices/forsythe.jl index 738f788..a9d011c 100644 --- a/src/matrices/forsythe.jl +++ b/src/matrices/forsythe.jl @@ -1,7 +1,7 @@ """ Forsythe Matrix =============== -The Forsythe matrix is a n-by-n perturbed Jordan block. +The Forsythe matrix is an `n`-by-`n` perturbed Jordan block. This generator is adapted from N. J. Higham's Test Matrix Toolbox. # Input Options diff --git a/src/matrices/frank.jl b/src/matrices/frank.jl index e3ba397..9506877 100644 --- a/src/matrices/frank.jl +++ b/src/matrices/frank.jl @@ -2,7 +2,7 @@ Frank Matrix ============ The Frank matrix is an upper Hessenberg matrix with -determinant 1. The eigenvalues are real, positive and +determinant 1. The eigenvalues are real, positive, and very ill conditioned. # Input Options diff --git a/src/matrices/gcdmat.jl b/src/matrices/gcdmat.jl index f64355c..d4cd878 100644 --- a/src/matrices/gcdmat.jl +++ b/src/matrices/gcdmat.jl @@ -1,8 +1,8 @@ """ GCDMat Matrix ============= -A matrix with `(i,j)` entry `gcd(i,j)`. It is a symmetric positive - definite matrix. +A matrix whose `(i,j)` entry is `gcd(i,j)`. +It is a symmetric positive definite matrix. # Input Options - dim: the dimension of the matrix. diff --git a/src/matrices/gearmat.jl b/src/matrices/gearmat.jl index d0258e7..e9fe588 100644 --- a/src/matrices/gearmat.jl +++ b/src/matrices/gearmat.jl @@ -1,13 +1,15 @@ """ Gear Matrix =========== -A gear matrix. 1's on the sub and super diagonal, -sign(i) on the (1,abs(i)) and sign(j) on the (n,n+1-abs(j)) position, -other elements are 0. +The Gear matrix has ones on the first subdiagonal and superdiagonal, and +has two additional entries of value ±1. Given the two integers +`-n ≤ i ≤ n` and `-n ≤ j ≤ n`, the matrix has the elements +`sign(i)` in position `(1, abs(i))` and `sign(j)` in position `(n, n+1-abs(j))`. +The other elements are zeros. # Input Options +- dim, i, j: the dimension of the matrix and the position of the 1s. - dim: the dimension of the matrix. `i = n` and `j = -n` by default. -- dim, i, j: the dimension of the matrix and the position of the 1's. # References **C. W. Gear**, A simple set of test matrices for eigenvalue programs, diff --git a/src/matrices/golub.jl b/src/matrices/golub.jl index f423481..7ca1bcb 100644 --- a/src/matrices/golub.jl +++ b/src/matrices/golub.jl @@ -1,9 +1,10 @@ """ Golub Matrix ============ -Golub matrix is the product of two random unit lower and upper - triangular matrices respectively. LU factorization without pivoting - fails to reveal that such matrices are badly conditioned. +The Golub matrix is the product of two random matrices, the first is +unit lower triangular and the second is upper triangular. The LU +factorization without pivoting fails to reveal that such matrices +are badly conditioned. # Input Options - dim: the dimension of the matrix. diff --git a/src/matrices/hadamard.jl b/src/matrices/hadamard.jl index 3f4f927..91a2a3b 100644 --- a/src/matrices/hadamard.jl +++ b/src/matrices/hadamard.jl @@ -1,9 +1,9 @@ """ Hadamard Matrix =============== -The Hadamard matrix is a square matrix whose entries are -1 or -1. It was named after Jacques Hadamard. The rows of -a Hadamard matrix are orthogonal. +The Hadamard matrix is a square matrix of order a power of 2, +whose entries are `1` or `–1`. It was named after Jacques +Hadamard. The rows of a Hadamard matrix are orthogonal. # Input Options - dim: the dimension of the matrix, `dim` is a power of 2. diff --git a/src/matrices/hankel.jl b/src/matrices/hankel.jl index c101553..00b6f68 100644 --- a/src/matrices/hankel.jl +++ b/src/matrices/hankel.jl @@ -1,8 +1,7 @@ """ Hankel Matrix ============= -A Hankel matrix is a matrix that is symmetric and constant - across the anti-diagonals. +A Hankel matrix is constant across the anti-diagonals. It is symmetric. # Input Options - vc, vr: `vc` and `vc` are the first column and last row of the diff --git a/src/matrices/hanowa.jl b/src/matrices/hanowa.jl index 4991015..3d954a7 100644 --- a/src/matrices/hanowa.jl +++ b/src/matrices/hanowa.jl @@ -1,7 +1,8 @@ """ Hanowa Matrix ============= -The Hanowa matrix is a matrix which eigenvalues lie on a vertical line in the complex plane. +The Hanowa matrix is a matrix whose eigenvalues lie +on a vertical line in the complex plane. # Input Options - dim: the dimension of the matrix and `alpha = -1`. diff --git a/src/matrices/inversehilbert.jl b/src/matrices/inversehilbert.jl index 3cedce2..6ab23d0 100644 --- a/src/matrices/inversehilbert.jl +++ b/src/matrices/inversehilbert.jl @@ -1,6 +1,7 @@ """ Inverse of the Hilbert Matrix ============================= +This is the inverse of the Hilbert matrix. See also [`Hilbert`](@ref). diff --git a/src/matrices/invhess.jl b/src/matrices/invhess.jl index 4aadb46..38facc2 100644 --- a/src/matrices/invhess.jl +++ b/src/matrices/invhess.jl @@ -1,7 +1,7 @@ """ Invhess Matrix ============== -Inverse of upper Hessenberg matrix. +This matrix is thenverse of an upper Hessenberg matrix. # Input Options - dim: the dimension of the matrix. `x = [1:dim;]`. diff --git a/src/matrices/ipjfact.jl b/src/matrices/ipjfact.jl index 2b4b032..90b8fcb 100644 --- a/src/matrices/ipjfact.jl +++ b/src/matrices/ipjfact.jl @@ -8,6 +8,11 @@ Hankel matrix with factorial elements. - dim, k: `k = 0` element `(i, j)` is `factorial(i + j)`. `k = 1` element `(i, j)` is `1 / factorial(i + j)`. + +# References +**K. Habermann*, An explicit formula for the inverse of a factorial +Hankel matrix, Australasian J. Comb., 79 (2021), pp. 250-255. +https://ajc.maths.uq.edu.au/pdf/79/ajc_v79_p250.pdf """ struct Ipjfact{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/jordbloc.jl b/src/matrices/jordbloc.jl index d0d5f1c..40b14cf 100644 --- a/src/matrices/jordbloc.jl +++ b/src/matrices/jordbloc.jl @@ -1,8 +1,7 @@ """ Jordan Block Matrix =================== -Jordan block matrix with `lambda` on the diagonal and 1 on the superdiagonal. -It's eigenvalues are `lambda`. +Jordan block corresponding to the eigenvalue λ. # Input Options - dim: dimension of the matrix. `lambda = 1`. diff --git a/src/matrices/kahan.jl b/src/matrices/kahan.jl index 08f6e81..e371f1f 100644 --- a/src/matrices/kahan.jl +++ b/src/matrices/kahan.jl @@ -3,8 +3,9 @@ Kahan Matrix ============ The Kahan matrix is an upper trapezoidal matrix, i.e., the `(i,j)` element is equal to `0` if `i > j`. The useful range of - `θ` is `0 < θ < π`. The diagonal is perturbed by - `pert*eps()*diagm([n:-1:1;])`. +`θ` is `0 < θ < π`. + +The diagonal is perturbed by `pert*eps()*diagm([n:-1:1;])`. # Input Options - rowdim, coldim, θ, pert: `rowdim` and `coldim` are the row and column diff --git a/src/matrices/krylov.jl b/src/matrices/krylov.jl index fb170f6..014ba67 100644 --- a/src/matrices/krylov.jl +++ b/src/matrices/krylov.jl @@ -1,7 +1,8 @@ """ Krylov Matrix ============= -Krylow matrix equal to [x, B*x, B^2*x, ..., B^(k-1)*x]. +The basis of a Krylow subspace. The matrix has columns +`[x, A*x, A^2*x, ..., A^(k-1)*x]`. # Input Options - dim: dimension of the matrix. `A = randn(dim, dim)`. `x = ones(dim)`. `k = dim`. @@ -9,7 +10,7 @@ Krylow matrix equal to [x, B*x, B^2*x, ..., B^(k-1)*x]. - dim, x, k: dimension of the matrix, x and k. - A: matrix. `x = ones(size(A, 1))`. `k = size(A, 1)`. - A, x: matrix and x. `k = size(A, 1)`. -- A, x, k: matrix, x and k. +- A, x, k: matrix, x, and k. """ struct Krylov{T<:Number} <: AbstractMatrix{T} n::Integer diff --git a/src/matrices/lauchli.jl b/src/matrices/lauchli.jl index 93c188f..e3e7f93 100644 --- a/src/matrices/lauchli.jl +++ b/src/matrices/lauchli.jl @@ -6,6 +6,11 @@ A matrix with ones on the first row, `mu` on the subdiagonal, and zeros elsewher # Input Options - dim: the dimension of the matrix. `mu = sqrt(eps())` by default. - dim, mu: the dimension and subdiagonal value of the matrix. + +# References +**P. Lauchli**, Jordan-Elimination und Ausgleichung nach kleinsten +Quadraten, Numer. Math, 3 (1961), pp. 226-240. +https://doi.org/10.1007/BF01386022 """ struct Lauchli{T<:Number} <: AbstractMatrix{T} m::Integer diff --git a/src/matrices/lehmer.jl b/src/matrices/lehmer.jl index 397fd76..1932d52 100644 --- a/src/matrices/lehmer.jl +++ b/src/matrices/lehmer.jl @@ -2,8 +2,8 @@ Lehmer Matrix ============= The Lehmer matrix is a symmetric positive definite matrix. - It is totally nonnegative. The inverse is tridiagonal and - explicitly known +It is totally nonnegative. The inverse is tridiagonal and +explicitly known. # Input Options - dim: the dimension of the matrix. diff --git a/src/matrices/lotkin.jl b/src/matrices/lotkin.jl index 1069728..99a320c 100644 --- a/src/matrices/lotkin.jl +++ b/src/matrices/lotkin.jl @@ -2,8 +2,8 @@ Lotkin Matrix ============= The Lotkin matrix is the Hilbert matrix with its first row - altered to all ones. It is unsymmetric, illcond and - has many negative eigenvalues of small magnitude. +altered to all ones. It is ill conditioned and has many +negative eigenvalues of small magnitude. # Input Options - dim: `dim` is the dimension of the matrix. diff --git a/src/matrices/poisson.jl b/src/matrices/poisson.jl index fc045b5..e3bb7fc 100644 --- a/src/matrices/poisson.jl +++ b/src/matrices/poisson.jl @@ -1,8 +1,8 @@ """ Poisson Matrix ============== -A block tridiagonal matrix from Poisson’s equation. - This matrix is sparse, symmetric positive definite and +A block tridiagonal matrix from Poisson's equation. + This matrix is sparse, symmetric positive definite, and has known eigenvalues. # Input Options diff --git a/src/matrices/redheff.jl b/src/matrices/redheff.jl index 489ebd5..ee6e9b9 100644 --- a/src/matrices/redheff.jl +++ b/src/matrices/redheff.jl @@ -1,7 +1,7 @@ """ Redheffer Matrix ================ -Redheffer matrix of 1s and 0s. +The Redheffer matrix contains only 1s and 0s. # Input Options - dim: the dimension of the matrix. diff --git a/src/matrices/smoke.jl b/src/matrices/smoke.jl index 54debba..c7f7e7f 100644 --- a/src/matrices/smoke.jl +++ b/src/matrices/smoke.jl @@ -2,7 +2,8 @@ Smoke Matrix ============ Complex matrix with a "smoke ring" pseudospectrum. -1's on the superdiagonal, cos(w) + sin(w) * im on the diagonal. +The matrix has ones on the superdiagonal, and +cos(w) + sin(w) * im on the diagonal. The `A(n, 1)`` entry is 1 if k = 0, 0 if k = 1. # Input Options diff --git a/src/matrices/wathen.jl b/src/matrices/wathen.jl index 37e9c83..4c56011 100644 --- a/src/matrices/wathen.jl +++ b/src/matrices/wathen.jl @@ -3,18 +3,15 @@ using SparseArrays: sparse """ Wathen Matrix ============= -Wathen Matrix is a sparse, symmetric positive, random matrix -arose from the finite element method. The generated matrix is -the consistent mass matrix for a regular nx-by-ny grid of -8-nodes. +The Wathen Matrix is the consistent mass matrix of a regular `nx`-by-`ny`` grid of +8 nodes in the finite element method. The matrix is a sparse, symmetric positive +definite, and has random entries. # Input Options - [type,] nx, ny: the dimension of the matrix is equal to `3 * nx * ny + 2 * nx * ny + 1`. - [type,] n: `nx = ny = n`. -*Groups:* ["symmetric", "posdef", "eigen", "random", "sparse"] - # References **A. J. Wathen**, Realistic eigenvalue bounds for the Galerkin mass matrix, IMA J. Numer. Anal., 7 (1987), pp. 449-457, diff --git a/src/matrices/wilkinson.jl b/src/matrices/wilkinson.jl index 20d849e..e79b97e 100644 --- a/src/matrices/wilkinson.jl +++ b/src/matrices/wilkinson.jl @@ -2,8 +2,7 @@ Wilkinson Matrix ================ The Wilkinson matrix is a symmetric tridiagonal matrix with pairs -of nearly equal eigenvalues. The most frequently used case -is the matrix of size 21. +of nearly equal eigenvalues. The most frequently used ordre is 21. # Input Options - dim: the dimension of the matrix. From 0f2d5938f9316e8e0b24a5802a15276072655d85 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Sun, 6 Oct 2024 21:42:57 +0100 Subject: [PATCH 07/17] refactor(core): expand property names --- src/metadata.jl | 22 +++++++++++----------- src/types.jl | 22 +++++++++++----------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/metadata.jl b/src/metadata.jl index 11009f2..a8c00db 100644 --- a/src/metadata.jl +++ b/src/metadata.jl @@ -12,34 +12,34 @@ const PROPERTIES = Dict{Type{<:PropertyTypes.AbstractProperty},Property}( PropertyTypes.Complex => :complex, PropertyTypes.Correlation => :correlation, PropertyTypes.Defective => :defective, - PropertyTypes.DiagDom => :diagdom, - PropertyTypes.Eigen => :eigen, + PropertyTypes.DiagonallyDominant => :diagdom, + PropertyTypes.Eigensystem => :eigen, PropertyTypes.FixedSize => :fixedsize, PropertyTypes.Graph => :graph, PropertyTypes.Hankel => :hankel, PropertyTypes.Hessenberg => :hessenberg, - PropertyTypes.IllCond => :illcond, + PropertyTypes.IllConditioned => :illcond, PropertyTypes.Indefinite => :indefinite, - PropertyTypes.InfDiv => :infdiv, + PropertyTypes.InfintelyDivisible => :infdiv, PropertyTypes.Integer => :integer, PropertyTypes.Inverse => :inverse, PropertyTypes.Involutory => :involutory, PropertyTypes.Nilpotent => :nilpotent, - PropertyTypes.NonNeg => :nonneg, + PropertyTypes.Nonnegative => :nonneg, PropertyTypes.Normal => :normal, PropertyTypes.Orthogonal => :orthogonal, PropertyTypes.Positive => :positive, - PropertyTypes.PosDef => :posdef, + PropertyTypes.PositiveDefinite => :posdef, PropertyTypes.Random => :random, - PropertyTypes.RankDef => :rankdef, + PropertyTypes.RankDeficient => :rankdef, PropertyTypes.Rectangular => :rectangular, - PropertyTypes.RegProb => :regprob, - PropertyTypes.SingVal => :singval, + PropertyTypes.RegularisationProblem => :regprob, + PropertyTypes.SingularValues => :singval, PropertyTypes.Sparse => :sparse, PropertyTypes.Symmetric => :symmetric, PropertyTypes.Toeplitz => :toeplitz, - PropertyTypes.TotNonNeg => :totnonneg, - PropertyTypes.TotPos => :totpos, + PropertyTypes.TotallyNonnegative => :totnonneg, + PropertyTypes.TotallyPositive => :totpos, PropertyTypes.Triangular => :triangular, PropertyTypes.Tridiagonal => :tridiagonal, PropertyTypes.Unimodular => :unimodular diff --git a/src/types.jl b/src/types.jl index a1bd35f..c6467eb 100644 --- a/src/types.jl +++ b/src/types.jl @@ -48,11 +48,11 @@ struct Defective <: AbstractProperty end """ The matrix is diagonally dominant. """ -struct DiagDom <: AbstractProperty end +struct DiagonallyDominant <: AbstractProperty end """ Part of the eigensystem of the matrix is explicitly known. """ -struct Eigen <: AbstractProperty end +struct Eigensystem <: AbstractProperty end """ The matrix is only available in some fixed sizes. """ @@ -72,7 +72,7 @@ struct Hessenberg <: AbstractProperty end """ The matrix is ill-conditioned for some parameter values. """ -struct IllCond <: AbstractProperty end +struct IllConditioned <: AbstractProperty end """ The matrix is indefinite for some parameter values. """ @@ -80,7 +80,7 @@ struct Indefinite <: AbstractProperty end """ The matrix is infinitely divisible. """ -struct InfDiv <: AbstractProperty end +struct InfintelyDivisible <: AbstractProperty end """ The matrix has integer entries. """ @@ -100,7 +100,7 @@ struct Nilpotent <: AbstractProperty end """ The matrix is nonnegative for some parameter values. """ -struct NonNeg <: AbstractProperty end +struct Nonnegative <: AbstractProperty end """ The matrix is normal. """ @@ -116,7 +116,7 @@ struct Positive <: AbstractProperty end """ The matrix is positive definite for some parameter values. """ -struct PosDef <: AbstractProperty end +struct PositiveDefinite <: AbstractProperty end """ The matrix has random entries. """ @@ -124,7 +124,7 @@ struct Random <: AbstractProperty end """ The matrix is rank deficient. """ -struct RankDef <: AbstractProperty end +struct RankDeficient <: AbstractProperty end """ The matrix is rectangular for some parameter values. """ @@ -132,11 +132,11 @@ struct Rectangular <: AbstractProperty end """ The output is a test problem for regularization methods. """ -struct RegProb <: AbstractProperty end +struct RegularisationProblem <: AbstractProperty end """ Part of the singular values and vectors of the matrix is explicitly known. """ -struct SingVal <: AbstractProperty end +struct SingularValues <: AbstractProperty end """ The matrix is sparse. """ @@ -160,11 +160,11 @@ struct Toeplitz <: AbstractProperty end """ The matrix is totally nonnegative for some parameter values. """ -struct TotNonNeg <: AbstractProperty end +struct TotallyNonnegative <: AbstractProperty end """ The matrix is totally positive for some parameter values. """ -struct TotPos <: AbstractProperty end +struct TotallyPositive <: AbstractProperty end """ The matrix is unimodular for some parameter values. """ From fac534be9690f67980a511a1c1721d2430b14f11 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Sun, 6 Oct 2024 21:45:26 +0100 Subject: [PATCH 08/17] fix(matrices): fix property lists --- src/matrices/chow.jl | 2 +- src/matrices/dorr.jl | 2 +- src/matrices/gearmat.jl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/matrices/chow.jl b/src/matrices/chow.jl index 47ad09c..246e20b 100644 --- a/src/matrices/chow.jl +++ b/src/matrices/chow.jl @@ -31,7 +31,7 @@ Chow(n::Integer, alpha, delta) = Chow{Int}(n, alpha, delta) Chow{T}(n::Integer) where {T<:Number} = Chow{T}(n, 1, 0) # metadata -@properties Chow [:hessenberg, :toeplitz, :binary, :eigen, :rankdef] +@properties Chow [:hessenberg, :toeplitz, :binary, :eigen, :rankdef, :inverse] # properties size(A::Chow) = (A.n, A.n) diff --git a/src/matrices/dorr.jl b/src/matrices/dorr.jl index 116d78a..d1edb5a 100644 --- a/src/matrices/dorr.jl +++ b/src/matrices/dorr.jl @@ -50,4 +50,4 @@ function Dorr{T}(n::Integer, theta::T) where {T<:Number} end # metadata -@properties Dorr [:tridiagonal, :diagdom, :illcond, :sparse] \ No newline at end of file +@properties Dorr [:tridiagonal, :diagdom, :illcond, :sparse] diff --git a/src/matrices/gearmat.jl b/src/matrices/gearmat.jl index e9fe588..916856a 100644 --- a/src/matrices/gearmat.jl +++ b/src/matrices/gearmat.jl @@ -35,7 +35,7 @@ GearMat(n::Integer, i::Integer, j::Integer) = GearMat{Int}(n, i, j) GearMat{T}(n::Integer) where {T<:Number} = GearMat{T}(n, n, -n) # metadata -@properties GearMat Symbol[:eigen, :rankdef, :integer] +@properties GearMat Symbol[:defective, :eigen, :rankdef, :integer, :sparse] # properties size(A::GearMat) = (A.n, A.n) From 5cc67df30ecd81e02763724dacf24160e14046fb Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Wed, 9 Oct 2024 17:05:32 +0100 Subject: [PATCH 09/17] fix(matrices): fix property lists --- src/matrices/binomial.jl | 2 +- src/matrices/chow.jl | 7 ++++--- src/matrices/clement.jl | 2 +- src/matrices/hilbert.jl | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/matrices/binomial.jl b/src/matrices/binomial.jl index 697fd38..14104a9 100644 --- a/src/matrices/binomial.jl +++ b/src/matrices/binomial.jl @@ -24,7 +24,7 @@ end Binomial(n::Integer) = Binomial{Int}(n) # metadata -@properties Binomial [:involutory, :integer] +@properties Binomial [:integer] # It is not :involutory, but a multiple thereof. # properties size(A::Binomial) = (A.n, A.n) diff --git a/src/matrices/chow.jl b/src/matrices/chow.jl index 246e20b..3c79c82 100644 --- a/src/matrices/chow.jl +++ b/src/matrices/chow.jl @@ -6,7 +6,7 @@ The Chow matrix is a singular Toeplitz lower-Hessenberg matrix. # Input Options - dim, alpha, delta: `dim` is dimension of the matrix. `alpha`, `delta` are scalars such that `A[i,i] = alpha + delta` and - `A[i,j] = alpha^(i + 1 -j)` for `j + 1 <= i`. + `A[i,j] = alpha^(i - j + 1)` for `j + 1 <= i`. - dim: `alpha = 1`, `delta = 0`. # References @@ -27,11 +27,12 @@ end # constructors Chow(n::Integer) = Chow(n, 1, 0) -Chow(n::Integer, alpha, delta) = Chow{Int}(n, alpha, delta) +Chow(n::Integer, alpha::T, delta::T) where {T<:Number} = Chow{T}(n, alpha, delta) +Chow(n::Integer, alpha::S, delta::T) where {S,T<:Number} = Chow{typejoin(S,T)}(n, alpha, delta) Chow{T}(n::Integer) where {T<:Number} = Chow{T}(n, 1, 0) # metadata -@properties Chow [:hessenberg, :toeplitz, :binary, :eigen, :rankdef, :inverse] +@properties Chow [:hessenberg, :toeplitz, :eigen, :inverse] # properties size(A::Chow) = (A.n, A.n) diff --git a/src/matrices/clement.jl b/src/matrices/clement.jl index cec7583..337ad67 100644 --- a/src/matrices/clement.jl +++ b/src/matrices/clement.jl @@ -40,4 +40,4 @@ function Clement{T}(n::Integer, k::Integer) where {T} end # metadata -@properties Clement [:tridiagonal, :eigen, :singval] +@properties Clement [:tridiagonal, :eigen, :nonneg, :singval] # :posdef if k = 0, :symmetric if k = 1. diff --git a/src/matrices/hilbert.jl b/src/matrices/hilbert.jl index 1c2bba8..47d84b9 100644 --- a/src/matrices/hilbert.jl +++ b/src/matrices/hilbert.jl @@ -38,7 +38,7 @@ Hilbert{T}(n::Integer) where {T<:Number} = Hilbert{T}(n, n) Hilbert{T}(m::Integer, n::Integer) where {T<:Integer} = Hilbert{Rational{T}}(m, n) # metadata -@properties Hilbert [:symmetric, :inverse, :illcond, :posdef, :totpos] +@properties Hilbert [:symmetric, :inverse, :hankel, :illcond, :posdef, :totpos] # properties size(A::Hilbert) = (A.m, A.n) From 2ba523fbede6f85227ada230b0850c300d77ff87 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Thu, 10 Oct 2024 11:26:15 +0100 Subject: [PATCH 10/17] docs(docs): reorder properties alphabetically --- docs/src/references/3.properties.md | 58 ++++++++++++++--------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/src/references/3.properties.md b/docs/src/references/3.properties.md index 34c5d59..620c6fe 100644 --- a/docs/src/references/3.properties.md +++ b/docs/src/references/3.properties.md @@ -4,41 +4,41 @@ Some documentation of the following properties are adapted from MatrixDepot.jl. ```@docs TypedMatrices.PropertyTypes.AbstractProperty -TypedMatrices.PropertyTypes.Symmetric -TypedMatrices.PropertyTypes.Inverse -TypedMatrices.PropertyTypes.Involutory -TypedMatrices.PropertyTypes.Integer -TypedMatrices.PropertyTypes.IllCond -TypedMatrices.PropertyTypes.PosDef +TypedMatrices.PropertyTypes.Bidiagonal +TypedMatrices.PropertyTypes.Binary +TypedMatrices.PropertyTypes.Circulant +TypedMatrices.PropertyTypes.Complex TypedMatrices.PropertyTypes.Correlation -TypedMatrices.PropertyTypes.Eigen -TypedMatrices.PropertyTypes.Sparse -TypedMatrices.PropertyTypes.Random -TypedMatrices.PropertyTypes.RegProb +TypedMatrices.PropertyTypes.Defective +TypedMatrices.PropertyTypes.DiagonallyDominant +TypedMatrices.PropertyTypes.Eigensystem +TypedMatrices.PropertyTypes.FixedSize TypedMatrices.PropertyTypes.Graph -TypedMatrices.PropertyTypes.TotNonNeg -TypedMatrices.PropertyTypes.TotPos -TypedMatrices.PropertyTypes.InfDiv +TypedMatrices.PropertyTypes.Hankel +TypedMatrices.PropertyTypes.Hessenberg +TypedMatrices.PropertyTypes.IllConditioned TypedMatrices.PropertyTypes.Indefinite -TypedMatrices.PropertyTypes.Defective +TypedMatrices.PropertyTypes.InfinitelyDivisible +TypedMatrices.PropertyTypes.Integer +TypedMatrices.PropertyTypes.Inverse +TypedMatrices.PropertyTypes.Involutory TypedMatrices.PropertyTypes.Nilpotent -TypedMatrices.PropertyTypes.Hessenberg -TypedMatrices.PropertyTypes.Toeplitz -TypedMatrices.PropertyTypes.Binary -TypedMatrices.PropertyTypes.RankDef -TypedMatrices.PropertyTypes.Circulant +TypedMatrices.PropertyTypes.Nonnegative TypedMatrices.PropertyTypes.Normal TypedMatrices.PropertyTypes.Orthogonal -TypedMatrices.PropertyTypes.Bidiagonal -TypedMatrices.PropertyTypes.Tridiagonal -TypedMatrices.PropertyTypes.Triangular -TypedMatrices.PropertyTypes.SingVal +TypedMatrices.PropertyTypes.Positive +TypedMatrices.PropertyTypes.PositiveDefinite +TypedMatrices.PropertyTypes.Random +TypedMatrices.PropertyTypes.RankDeficient TypedMatrices.PropertyTypes.Rectangular -TypedMatrices.PropertyTypes.Hankel -TypedMatrices.PropertyTypes.DiagDom -TypedMatrices.PropertyTypes.NonNeg +TypedMatrices.PropertyTypes.RegularisationProblem +TypedMatrices.PropertyTypes.SingularValues +TypedMatrices.PropertyTypes.Sparse +TypedMatrices.PropertyTypes.Symmetric +TypedMatrices.PropertyTypes.Triangular +TypedMatrices.PropertyTypes.Tridiagonal +TypedMatrices.PropertyTypes.Toeplitz +TypedMatrices.PropertyTypes.TotallyNonnegative +TypedMatrices.PropertyTypes.TotallyPositive TypedMatrices.PropertyTypes.Unimodular -TypedMatrices.PropertyTypes.Positive -TypedMatrices.PropertyTypes.FixedSize -TypedMatrices.PropertyTypes.Complex ``` From bcead7e76114e64b07e1b79411c88d542ad82c47 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Thu, 10 Oct 2024 12:02:10 +0100 Subject: [PATCH 11/17] fix(core): fix typo in property name --- src/metadata.jl | 2 +- src/types.jl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/metadata.jl b/src/metadata.jl index a8c00db..8fb998a 100644 --- a/src/metadata.jl +++ b/src/metadata.jl @@ -20,7 +20,7 @@ const PROPERTIES = Dict{Type{<:PropertyTypes.AbstractProperty},Property}( PropertyTypes.Hessenberg => :hessenberg, PropertyTypes.IllConditioned => :illcond, PropertyTypes.Indefinite => :indefinite, - PropertyTypes.InfintelyDivisible => :infdiv, + PropertyTypes.InfinitelyDivisible => :infdiv, PropertyTypes.Integer => :integer, PropertyTypes.Inverse => :inverse, PropertyTypes.Involutory => :involutory, diff --git a/src/types.jl b/src/types.jl index c6467eb..49c6c3d 100644 --- a/src/types.jl +++ b/src/types.jl @@ -80,7 +80,7 @@ struct Indefinite <: AbstractProperty end """ The matrix is infinitely divisible. """ -struct InfintelyDivisible <: AbstractProperty end +struct InfinitelyDivisible <: AbstractProperty end """ The matrix has integer entries. """ From 065278d2d024e1249522b26f15f4d383101dc9af Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Thu, 10 Oct 2024 12:04:27 +0100 Subject: [PATCH 12/17] test(matrices): add coverage for new Chow constructor --- test/matrices/chow.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/matrices/chow.jl b/test/matrices/chow.jl index af237f8..cefd860 100644 --- a/test/matrices/chow.jl +++ b/test/matrices/chow.jl @@ -7,7 +7,7 @@ ]) # linear algebra functions -run_test_linear_algebra_functions([Chow.(1:5); Chow.(1:5, 2, 3)]) +run_test_linear_algebra_functions([Chow.(1:5); Chow.(1:5, 2, 3); Chow.(1:5, 1.1, 3)]) # eltype @test test_matrix_elements(Chow{Int32}(5)) From e40cd282f3fb54dd01df073e72882b8f5734846c Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Thu, 10 Oct 2024 17:31:53 +0100 Subject: [PATCH 13/17] docs(docs): update documentation landing page and manual --- docs/src/index.md | 17 ++++---- docs/src/manual/1.getting-started.md | 63 +++++++++++++++++----------- docs/src/manual/2.performance.md | 10 ++--- 3 files changed, 52 insertions(+), 38 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index b4b2e96..7966ec7 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -1,15 +1,14 @@ -# TypedMatrices.jl Documentation +# TypedMatrices.jl -Welcome to the documentation for TypedMatrices.jl. +Welcome to the documentation of `TypedMatrices.jl`, an extensible matrix collection for Julia. The matrices in the library can be used to test algorithms or check (and potentially disprove) linear algebra conjectures numerically. -An extensible Julia matrix collection utilizing type system to enhance performance. +The package relies on the Julia type system to enhance performance by improving the matrix generation time and reducing storage requirements. -Check [Getting Started](@ref) for a quick start. +To get started, check out the [Getting Started](@ref) section. ## Features -- Matrix Types: Types representing special matrices that can be used for algorithm testing or other computations. -- Linear Algebra Operations: Operations are fine-tuned to enhance the performance of these matrix types. -- Matrix Properties (Tags): Users can add properties (tags) to matrices, which can be used for organization or computation. -- Matrix Grouping: Matrices can be grouped together depending on types or properties, with the flexibility for users to define their own types. -- Filtering by Properties/Groups: Matrices can be filtered by property or group for more targeted computations. +- Each special matrix has its own Julia type, and users can define new types compatible with the package using the interface provided. +- Many linear algebra operations are implemented using explicit formulas, when known, to enhance performance. +- The matrices in the collection can be filtered by property, to find examples that satisfy a set of properties of interest. +- Users can create matrix groups to retrieve and organize the types in the collection. diff --git a/docs/src/manual/1.getting-started.md b/docs/src/manual/1.getting-started.md index 9c26a3a..6bc3ca4 100644 --- a/docs/src/manual/1.getting-started.md +++ b/docs/src/manual/1.getting-started.md @@ -2,7 +2,7 @@ ## Installation -TypedMatrices.jl is a registered package in the Julia package registry. Use Julia's package manager to install it: +`TypedMatrices.jl` is registered in the Julia package registry, and Julia's builtin package manager can be used to install it: ```julia-repl pkg> add TypedMatrices @@ -10,77 +10,92 @@ pkg> add TypedMatrices ## Setup -Use the package: +The first step is, as usual, to load the package: ```@repl getting-started using TypedMatrices ``` -You can list all matrices available with [`list_matrices`](@ref): +The list of available matrices can be obtained with [`list_matrices`](@ref): ```@repl getting-started -list_matrices() +matrix_list = list_matrices() +``` + +The function returns a `Vector` of matrix types, which are subtypes of `AbstractMatrix`. The elements of this `Vector` can be used to generate matrices: + +```@repl getting-started +matrix_list[1](5) ``` -## Creating Matrices +## Generating Matrices -Each type of matrix has its own type and constructors. For example, to create a 5x5 [Hilbert](@ref) matrix: +Each type of special matrices has its own type and constructors. For example, a 5 × 5 [Hilbert](@ref) matrix can be generated with: ```@repl getting-started h = Hilbert(5) ``` -Most matrices can accept a type parameter to specify the element type. For example, to create a 5x5 Hilbert matrix with `Float64` elements: +Most matrices can accept a type parameter to specify the element type. For example, a 5 × 5 Hilbert matrix with `Float64` elements can be generated with: ```@repl getting-started Hilbert{Float64}(5) ``` -Please check [Builtin Matrices](@ref) for all available builtin matrices. +Please check the list of [Builtin Matrices](@ref) for an overview of all available types. ## Properties -Matrix has properties like `symmetric`, `illcond`, and `posdef`. Function [`properties`](@ref) can be used to get the properties of a matrix: +Matrices have properties such as "symmetric", "ill conditioned", or "positive definite". + +The function [`list_properties`](@ref) can be used to show all properties currently defined in `TypedMatrices.jl`: ```@repl getting-started -properties(Hilbert) +list_matrices() ``` -You can also check properties of a matrix instance for convinience: +The function [`properties`](@ref) can used to get the properties of a given matrix type: ```@repl getting-started -properties(h) +properties(Hilbert) ``` -To view all available properties, use [`list_properties`](@ref): +For convenience, the same function can be used to list the properties of a matrix instance, rather than a type: ```@repl getting-started -list_properties() +properties(h) ``` ## Grouping -This package has a grouping feature to group matrices. All builtin matrices are in the `builtin` group, we also create a `user` group for user-defined matrices. You can list all groups with: +Matrices can be organized by creating user-defined groups. All builtin matrices belong to the `:builtin` group, and the package comes with an empty `:user` group for user-defined matrices. All available groups can be listed with: ```@repl getting-started list_groups() ``` -To add a matrix to groups and enable it to be listed by [`list_matrices`](@ref), use [`add_to_groups`](@ref): - +The function [`add_to_groups`](@ref) can be used to add a matrix to a group: ```@repl getting-started add_to_groups(Matrix, :user, :test) +``` + +The function [`list_matrices`](@ref) can be used to list the matrices that belong to a chosen group: + +```@repl getting-started list_matrices(Group(:user)) ``` -We can also add builtin matrices to our own groups: +Builtin matrices can also be added to a group: ```@repl getting-started add_to_groups(Hilbert, :test) list_matrices(Group(:test)) ``` -To remove a matrix from a group or all groups, use [`remove_from_group`](@ref) or [`remove_from_all_groups`](@ref). The empty group will automatically be removed: +A matrix can be removed +- from a specific group, with [`remove_from_group`](@ref), or +- from all groups, with [`remove_from_all_groups`](@ref). +Matrices cannot be removed from the `:builtin` group, and user-defined groups are automatically removed when they become empty: ```@repl getting-started remove_from_group(Hilbert, :test) @@ -90,16 +105,16 @@ list_groups() ## Finding Matrices -[`list_matrices`](@ref) is very powerful to list matrices, and filter by groups and properties. All arguments are "and" relationship, i.e. listed matrices must satisfy all conditions. +[`list_matrices`](@ref) is a powerful function to search for matrices, and filter the results by groups or properties. All arguments are "and" relationship, meaning that only matrices that satisfy all conditions will be retained. -For example, to list all matrices in the `builtin` group, and all matrices with `symmetric` property: +For example, one can list all the matrices in the `:builtin` group, or all those that are satisfy the `:symmetric` property: ```@repl getting-started list_matrices(Group(:builtin)) list_matrices(Property(:symmetric)) ``` -To list all matrices in the `builtin` group with `inverse`, `illcond`, and `eigen` properties: +One can also combine the two filters and show all matrices in the `:builtin` group that satisfy the `:inverse`, `:illcond`, and `:eigen` properties: ```@repl getting-started list_matrices( @@ -114,10 +129,10 @@ list_matrices( ) ``` -To list all matrices with `symmetric`, `eigen`, and `posdef` properties: +A simpler syntax can be used to list all matrices that satisfy a list of properties. For example, all matrices with `:symmetric`, `:eigen`, and `:posdef` can be listed with: ```@repl getting-started list_matrices(:symmetric, :eigen, :posdef) ``` -There are many alternative interfaces using `list_matrices`, please check the [`list_matrices`](@ref) or use Julia help system for more information. +The `list_matrices` functions provides a number of alternative interfaces. Check the full documentation of [`list_matrices`](@ref) or use the Julia help system for a complete list. diff --git a/docs/src/manual/2.performance.md b/docs/src/manual/2.performance.md index e378126..e717581 100644 --- a/docs/src/manual/2.performance.md +++ b/docs/src/manual/2.performance.md @@ -1,10 +1,10 @@ # Performance -We will briefly discuss the performance in this page. +We will give a few examples the illustrate the performance of the collection. ## Linear Algebra Properties of Typed Matrices -`LinearAlgebra.jl` provides several linear algebra operations. By utilizing the Julia type system, we can improve the performance of some of these operations for special matrices. The default method for the `issymmetric` function, for example, checks that a matrix satisfies the definition of symmetry by accessing each matrix element. The matrix `Minij` is explicitly known to be symmetric, and `TypedMatrices.jl` defines a new method for `issymmetric` that simply returns `true`. +`LinearAlgebra.jl` provides several linear algebra operations. By utilizing the Julia type system, we can improve the performance of some of these operations for special matrices. The default method for the `issymmetric` function, for example, checks that a matrix satisfies the definition of symmetry by accessing each matrix element. The matrix `Minij` is known to be symmetric, and `TypedMatrices.jl` defines a new method for `issymmetric` that simply returns `true`. On the `Minij` matrix of order 1000 this specialised method is over 80,000 times faster than the default implementations in the median case. @@ -44,7 +44,7 @@ BenchmarkTools.Trial: 4883 samples with 1 evaluation. ## Known Algorithm Working on `Hilbert` -The following example shows a known algorithm that works on `Hilbert` matrices. The variable `a` is of type `Hilbert`, and `b` represents the same matrix but is a variable of type `Matrix`. Computing the determinant of `b` is 280 times slower and requires almost 1,000 times more memory than computing that of `a`. +The following example shows a known algorithm that works on `Hilbert` matrices. The variable `a` is of type `Hilbert`, whereas `b` is a variable of type `Matrix` representing the same matrix. Computing the determinant of `b` is 280 times slower and requires almost 1,000 times more memory than computing that of `a`. ```julia-repl julia> a = Hilbert{BigFloat}(100) @@ -82,7 +82,7 @@ BenchmarkTools.Trial: 32 samples with 1 evaluation. ## Trade-off between Performance and Memory -For algorithms not implemented in `TypedMatrices.jl`, this approach trades performance off for potentially substantial memory savings. For example, generating the variable `a`, of type `Cauchy` only requires **63.229 μs** and **114.16 KiB** of memory, while generating `b`, which is the same matrix but has type `Matrix`, requires **3.862 ms** and **7.74 MiB** of memory. And once generated, storing `b` requires 500,000 times more memory than storing `a`. +For algorithms not implemented in `TypedMatrices.jl`, the approach in `TypedMatrices.jl` trades performance off for—potentially substantial—memory savings. For example, generating the variable `a`, which is of type `Cauchy`, only requires **63.229 μs** and **114.16 KiB** of memory, while generating `b`, which is the same matrix but has type `Matrix`, requires **3.862 ms** and **7.74 MiB** of memory. And once generated, storing `b` requires 500,000 times more memory than storing `a`. ```julia-repl julia> @benchmark a = Cauchy{Float64}(1000) @@ -116,7 +116,7 @@ julia> Base.summarysize(b) 8000040 ``` -On the other hand, accessing an element of `a` requires computation, which is not the case for the elements of `b`, which are directly available in memory. This implies a performance penalty, which is not unexpected. In view of this trade-off, however, one can use extremely large matrices on machines with a moderate amount of memory, which allows users to tackle otherwise intractable problems. This is especially true for algorithms that only need to access a subset of the matrix elements. +On the other hand, accessing an element of `a` requires computation, whereas those of `b` have been pre-computed and are already available in memory. This implies a performance penalty, which is not unexpected. In view of this trade-off, however, one can use extremely large matrices on machines with a moderate amount of memory, which allows users to tackle otherwise intractably large problems. This is especially true for algorithms that only need to access a subset of the matrix elements. ```julia-repl julia> @benchmark det(a) From af59f14e3ff48fe0410a28b83887058d46178eee Mon Sep 17 00:00:00 2001 From: Andy Zhang <37402126+AnzhiZhang@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:40:03 +0000 Subject: [PATCH 14/17] docs(docs): update performance page --- docs/src/manual/2.performance.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/manual/2.performance.md b/docs/src/manual/2.performance.md index e717581..95b756b 100644 --- a/docs/src/manual/2.performance.md +++ b/docs/src/manual/2.performance.md @@ -82,7 +82,7 @@ BenchmarkTools.Trial: 32 samples with 1 evaluation. ## Trade-off between Performance and Memory -For algorithms not implemented in `TypedMatrices.jl`, the approach in `TypedMatrices.jl` trades performance off for—potentially substantial—memory savings. For example, generating the variable `a`, which is of type `Cauchy`, only requires **63.229 μs** and **114.16 KiB** of memory, while generating `b`, which is the same matrix but has type `Matrix`, requires **3.862 ms** and **7.74 MiB** of memory. And once generated, storing `b` requires 500,000 times more memory than storing `a`. +For algorithms not implemented in `TypedMatrices.jl`, the package trades performance off for—potentially substantial—memory savings. For example, generating the variable `a`, which is of type `Cauchy`, only requires **63.229 μs** and **114.16 KiB** of memory, while generating `b`, which is the same matrix but has type `Matrix`, requires **3.862 ms** and **7.74 MiB** of memory. And once generated, storing `b` requires 500,000 times more memory than storing `a`. ```julia-repl julia> @benchmark a = Cauchy{Float64}(1000) From c17e3b85796d3588ffb7407c9acdf4f572925b73 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Mon, 20 Jan 2025 10:06:11 +0000 Subject: [PATCH 15/17] feat(matrices): add logdet(::Hilbert) --- src/matrices/hilbert.jl | 5 +++++ test/runtests.jl | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/matrices/hilbert.jl b/src/matrices/hilbert.jl index 47d84b9..99fb69e 100644 --- a/src/matrices/hilbert.jl +++ b/src/matrices/hilbert.jl @@ -52,6 +52,11 @@ LinearAlgebra.issymmetric(A::Hilbert) = A.m == A.n return T(one(T) / (i + j - 1)) end +logc(x) = sum([sum(log.(1:i)) for i = 2:(x-1)]) +function LinearAlgebra.logdet(A::Hilbert) + LinearAlgebra.checksquare(A) + return (4 * logc(A.n) - logc(2 * A.n)) +end LinearAlgebra.det(A::Hilbert) = inv(det(inv(A))) function inv(A::Hilbert{T}) where {T} diff --git a/test/runtests.jl b/test/runtests.jl index 83ec762..3cb9b0f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -33,7 +33,7 @@ function test_linear_algebra_functions(A::AbstractMatrix) @try_catch results[func] = func(A) == func(matrix) end - computation_functions = [adjoint, transpose, det, eigvals] + computation_functions = [adjoint, transpose, det, logdet, eigvals] if determinant != 0 append!(computation_functions, [inv]) end From 7bd679632509f8b0b050b18a2ec515f6eb3626fc Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Mon, 20 Jan 2025 10:45:46 +0000 Subject: [PATCH 16/17] fix(core): fix typos in docs, error messages, and function names --- src/matrices.jl | 10 +++++----- src/metadata.jl | 12 ++++++------ test/metadata.jl | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/matrices.jl b/src/matrices.jl index cb556aa..a00a53e 100644 --- a/src/matrices.jl +++ b/src/matrices.jl @@ -27,7 +27,7 @@ list_groups() = collect(keys(MATRIX_GROUPS)) """ add_to_groups(type, groups) -Add a matrix type to groups. If a group is not exists, it will be created. +Add a matrix type to groups. If a group does not exist, it will be created. Groups `:builtin` and `:user` are special groups. It is suggested always to add matrices to the `:user` group. @@ -93,12 +93,12 @@ function remove_from_group(type::Type{<:AbstractMatrix}, group::Group) # check group exists if group ∉ keys(MATRIX_GROUPS) - throw(ArgumentError("Group $group not exists")) + throw(ArgumentError("Group $group does not exist")) end # check type exists in group if type ∉ MATRIX_GROUPS[group] - throw(ArgumentError("Matrix type $type not exists in group $group")) + throw(ArgumentError("Matrix type $type does not exist in group $group")) end # remove from group @@ -171,13 +171,13 @@ julia> list_matrices([Group(:builtin), Group(:user)]) """ function list_matrices(groups::Vector{Group}, props::Vector{Property}) # check properties - check_properties_exists(props...) + check_properties_exist(props...) # groups groups_results = union(values(MATRIX_GROUPS)...) for group = groups if group ∉ keys(MATRIX_GROUPS) - throw(ArgumentError("Group $group not exists")) + throw(ArgumentError("Group $group does not exist")) else intersect!(groups_results, MATRIX_GROUPS[group]) end diff --git a/src/metadata.jl b/src/metadata.jl index 8fb998a..ba050ae 100644 --- a/src/metadata.jl +++ b/src/metadata.jl @@ -66,7 +66,7 @@ julia> check_propertie_types(Int) ERROR: ArgumentError: Int64 is not a property type ``` """ -function check_propertie_types(props::DataType...) +function check_property_types(props::DataType...) for prop = props prop <: PropertyTypes.AbstractProperty || throw(ArgumentError("$prop is not a property type")) end @@ -82,12 +82,12 @@ Check properties exists. julia> check_properties_exists(Property(:symmetric), Property(:inverse)) julia> check_properties_exists(Property(:symmetric), Property(:notexists)) -ERROR: ArgumentError: Property Property(:notexists) not exists +ERROR: ArgumentError: Property Property(:notexists) does not exist ``` """ -function check_properties_exists(props::Property...) +function check_properties_exist(props::Property...) for prop = props - prop ∈ values(PROPERTIES) || throw(ArgumentError("Property $prop not exists")) + prop ∈ values(PROPERTIES) || throw(ArgumentError("Property $prop does not exist")) end end @@ -105,7 +105,7 @@ julia> property_types_to_properties(PropertyTypes.Symmetric, PropertyTypes.Inver ``` """ function property_types_to_properties(props::DataType...)::Vector{Property} - check_propertie_types(props...) + check_property_types(props...) return [PROPERTIES[prop] for prop = props] end @@ -153,7 +153,7 @@ julia> register_properties(Matrix, [PropertyTypes.Symmetric(), PropertyTypes.Inv """ function register_properties(T::Type, props::Vector{Property}) # check props - check_properties_exists(props...) + check_properties_exist(props...) # register properties @eval properties(::Type{<:$T}) = $props diff --git a/test/metadata.jl b/test/metadata.jl index c3c48c9..65f7a32 100644 --- a/test/metadata.jl +++ b/test/metadata.jl @@ -6,14 +6,14 @@ props = list_properties() @test all(isa.(props, Property)) # check_propertie_types -@test isnothing(TypedMatrices.check_propertie_types(PropertyTypes.Symmetric, PropertyTypes.Inverse)) -@test_throws ArgumentError TypedMatrices.check_propertie_types(Int) -@test_throws ArgumentError TypedMatrices.check_propertie_types(PropertyTypes.Symmetric, Int) +@test isnothing(TypedMatrices.check_property_types(PropertyTypes.Symmetric, PropertyTypes.Inverse)) +@test_throws ArgumentError TypedMatrices.check_property_types(Int) +@test_throws ArgumentError TypedMatrices.check_property_types(PropertyTypes.Symmetric, Int) # check_properties_exists -@test isnothing(TypedMatrices.check_properties_exists(Property(:symmetric), Property(:inverse))) -@test_throws ArgumentError TypedMatrices.check_properties_exists(Property(:notexists)) -@test_throws ArgumentError TypedMatrices.check_properties_exists(Property(:symmetric), Property(:notexists)) +@test isnothing(TypedMatrices.check_properties_exist(Property(:symmetric), Property(:inverse))) +@test_throws ArgumentError TypedMatrices.check_properties_exist(Property(:notexists)) +@test_throws ArgumentError TypedMatrices.check_properties_exist(Property(:symmetric), Property(:notexists)) # property_types_to_properties @test TypedMatrices.property_types_to_properties(PropertyTypes.Symmetric, PropertyTypes.Inverse) == [Property(:symmetric), Property(:inverse)] From fb8c7a06030f1726f853b3451ab97558753b3135 Mon Sep 17 00:00:00 2001 From: Massimiliano Fasi Date: Mon, 20 Jan 2025 17:21:14 +0000 Subject: [PATCH 17/17] test(matrices): enable computation functions in tests --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 3cb9b0f..5cbb51b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -37,7 +37,7 @@ function test_linear_algebra_functions(A::AbstractMatrix) if determinant != 0 append!(computation_functions, [inv]) end - for func in property_functions + for func in computation_functions @try_catch results[func] = func(A) ≈ func(matrix) end