Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ authors = ["Jutho Haegeman <jutho.haegeman@ugent.be>, Lukas Devos, Katharine Hya

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"

[weakdeps]
AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e"
Expand Down Expand Up @@ -35,6 +36,7 @@ EnzymeTestUtils = "0.2.5"
GenericLinearAlgebra = "0.3.19, 0.4"
GenericSchur = "0.5.6"
LinearAlgebra = "1"
PrecompileTools = "1"
Mooncake = "0.5.27"
ParallelTestRunner = "2"
Random = "1"
Expand Down
2 changes: 2 additions & 0 deletions src/MatrixAlgebraKit.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,6 @@ include("pullbacks/eigh.jl")
include("pullbacks/svd.jl")
include("pullbacks/polar.jl")

include("precompile.jl")

end
67 changes: 67 additions & 0 deletions src/precompile.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
using PrecompileTools: @compile_workload

@compile_workload begin
truncation_strategies = [
truncrank(2), trunctol(; atol = 1.0e-2), truncrank(2) & trunctol(; atol = 1.0e-2), truncerror(; atol = 1.0e-2) | truncfilter(x -> abs(x) < 1.0e-2),
]
for T in (Float32, Float64, ComplexF32, ComplexF64)
A = diagm(ones(T, 4)) # 4×4 Matrix{T}, Hermitian, nonsingular
Atall = rand(T, 4, 2)
Awide = rand(T, 2, 4)

# decompositions
# --------------
qr_compact(A)
qr_full(Atall)
qr_null(Atall)

lq_compact(A)
lq_full(Awide)
lq_null(Awide)

svd_compact(A)
svd_full(A)
svd_vals(A)

schur_full(A)
schur_vals(A)

eigh_full(A)
eigh_vals(A)

eig_full(A)
eig_vals(A)

gen_eig_full(A, A)
gen_eig_vals(A, A)

left_polar(A)
right_polar(A)

# derived decompositions
left_orth(A)
left_null(A)
right_orth(A)
right_null(A)

# truncated decompositions
for trunc in truncation_strategies
svd_trunc(A; trunc)
eigh_trunc(A; trunc)
eig_trunc(A; trunc)
end
left_orth(A; trunc = truncrank(2))
right_orth(A; trunc = truncrank(2))

# projections
project_hermitian(A)
project_antihermitian(A)
project_isometric(A)

# properties
isisometric(A)
isunitary(A)
ishermitian(A)
isantihermitian(A)
end
end
Loading