From 6ba7a22024e033557ba56868a2c29e94ce601374 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Tue, 29 Sep 2026 15:49:56 +0200 Subject: [PATCH 1/2] Precompile some missing factorizations logic --- src/precompile/factorizations.jl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/precompile/factorizations.jl b/src/precompile/factorizations.jl index 4b5793c1c..224958963 100644 --- a/src/precompile/factorizations.jl +++ b/src/precompile/factorizations.jl @@ -28,11 +28,25 @@ function precompile_factorizations(::Type{S}; eltypes = PRECOMPILE_ELTYPES) wher tw = randn(T, V ← W) # wide (domain larger) -> non-empty right null space th = (t + t') / 2 # hermitian (square, Euclidean inner product) + # projectors + project_hermitian(t) + project_antihermitian(t) + project_isometric(t) + + # exponential + exponential(th) + # Singular value decomposition svd_full(t) svd_compact(t) svd_vals(t) svd_trunc(t; trunc = truncrank(1)) + svd_trunc(t; trunc = trunctol(; atol = 1e-10)) + svd_trunc(t; trunc = truncerror(; atol = 1e-10)) + svd_trunc(t; trunc = notrunc()) + svd_trunc(t; trunc = truncspace(space(t, 1))) + svd_trunc(t; trunc = truncrank(1) | trunctol(; atol = 1e-10)) + svd_trunc(t; trunc = truncrank(1) & trunctol(; atol = 1e-10)) # QR / LQ decompositions (null-space variants on the appropriately shaped tensors) qr_full(t) @@ -45,8 +59,22 @@ function precompile_factorizations(::Type{S}; eltypes = PRECOMPILE_ELTYPES) wher # Eigenvalue decompositions (hermitian variants require a hermitian input) eig_full(t) eig_vals(t) + eig_trunc(t; trunc = truncrank(1)) + eig_trunc(t; trunc = trunctol(; atol = 1e-10)) + eig_trunc(t; trunc = truncerror(; atol = 1e-10)) + eig_trunc(t; trunc = notrunc()) + eig_trunc(t; trunc = truncspace(space(t, 1))) + eig_trunc(t; trunc = truncrank(1) | trunctol(; atol = 1e-10)) + eig_trunc(t; trunc = truncrank(1) & trunctol(; atol = 1e-10)) eigh_full(th) eigh_vals(th) + eigh_trunc(th; trunc = truncrank(1)) + eigh_trunc(th; trunc = trunctol(; atol = 1e-10)) + eigh_trunc(th; trunc = truncerror(; atol = 1e-10)) + eigh_trunc(th; trunc = notrunc()) + eigh_trunc(th; trunc = truncspace(space(th, 1))) + eigh_trunc(th; trunc = truncrank(1) | trunctol(; atol = 1e-10)) + eigh_trunc(th; trunc = truncrank(1) & trunctol(; atol = 1e-10)) # Orthogonal / null-space helpers left_orth(t) From fa5eaf367e5d774ee011012bb311024da2e46c50 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Tue, 29 Sep 2026 15:56:27 +0200 Subject: [PATCH 2/2] Formatter and suggestion --- src/precompile/factorizations.jl | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/precompile/factorizations.jl b/src/precompile/factorizations.jl index 224958963..61c8ac120 100644 --- a/src/precompile/factorizations.jl +++ b/src/precompile/factorizations.jl @@ -26,10 +26,9 @@ function precompile_factorizations(::Type{S}; eltypes = PRECOMPILE_ELTYPES) wher t = randn(T, W ← W) # square tr = randn(T, W ← V) # tall (codomain larger) -> non-empty left null space tw = randn(T, V ← W) # wide (domain larger) -> non-empty right null space - th = (t + t') / 2 # hermitian (square, Euclidean inner product) # projectors - project_hermitian(t) + th = project_hermitian(t) # hermitian (square, Euclidean inner product) project_antihermitian(t) project_isometric(t) @@ -41,12 +40,12 @@ function precompile_factorizations(::Type{S}; eltypes = PRECOMPILE_ELTYPES) wher svd_compact(t) svd_vals(t) svd_trunc(t; trunc = truncrank(1)) - svd_trunc(t; trunc = trunctol(; atol = 1e-10)) - svd_trunc(t; trunc = truncerror(; atol = 1e-10)) + svd_trunc(t; trunc = trunctol(; atol = 1.0e-10)) + svd_trunc(t; trunc = truncerror(; atol = 1.0e-10)) svd_trunc(t; trunc = notrunc()) svd_trunc(t; trunc = truncspace(space(t, 1))) - svd_trunc(t; trunc = truncrank(1) | trunctol(; atol = 1e-10)) - svd_trunc(t; trunc = truncrank(1) & trunctol(; atol = 1e-10)) + svd_trunc(t; trunc = truncrank(1) | trunctol(; atol = 1.0e-10)) + svd_trunc(t; trunc = truncrank(1) & trunctol(; atol = 1.0e-10)) # QR / LQ decompositions (null-space variants on the appropriately shaped tensors) qr_full(t) @@ -60,21 +59,21 @@ function precompile_factorizations(::Type{S}; eltypes = PRECOMPILE_ELTYPES) wher eig_full(t) eig_vals(t) eig_trunc(t; trunc = truncrank(1)) - eig_trunc(t; trunc = trunctol(; atol = 1e-10)) - eig_trunc(t; trunc = truncerror(; atol = 1e-10)) + eig_trunc(t; trunc = trunctol(; atol = 1.0e-10)) + eig_trunc(t; trunc = truncerror(; atol = 1.0e-10)) eig_trunc(t; trunc = notrunc()) eig_trunc(t; trunc = truncspace(space(t, 1))) - eig_trunc(t; trunc = truncrank(1) | trunctol(; atol = 1e-10)) - eig_trunc(t; trunc = truncrank(1) & trunctol(; atol = 1e-10)) + eig_trunc(t; trunc = truncrank(1) | trunctol(; atol = 1.0e-10)) + eig_trunc(t; trunc = truncrank(1) & trunctol(; atol = 1.0e-10)) eigh_full(th) eigh_vals(th) eigh_trunc(th; trunc = truncrank(1)) - eigh_trunc(th; trunc = trunctol(; atol = 1e-10)) - eigh_trunc(th; trunc = truncerror(; atol = 1e-10)) + eigh_trunc(th; trunc = trunctol(; atol = 1.0e-10)) + eigh_trunc(th; trunc = truncerror(; atol = 1.0e-10)) eigh_trunc(th; trunc = notrunc()) eigh_trunc(th; trunc = truncspace(space(th, 1))) - eigh_trunc(th; trunc = truncrank(1) | trunctol(; atol = 1e-10)) - eigh_trunc(th; trunc = truncrank(1) & trunctol(; atol = 1e-10)) + eigh_trunc(th; trunc = truncrank(1) | trunctol(; atol = 1.0e-10)) + eigh_trunc(th; trunc = truncrank(1) & trunctol(; atol = 1.0e-10)) # Orthogonal / null-space helpers left_orth(t)