Skip to content

Commit 5982740

Browse files
committed
New truncate interface
1 parent cd7011d commit 5982740

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ GPUArraysCore = "0.1, 0.2"
4141
LinearAlgebra = "1.10"
4242
MacroTools = "0.5.13"
4343
MapBroadcast = "0.1.5"
44-
MatrixAlgebraKit = "0.2.2, 0.3, 0.4, 0.5"
44+
MatrixAlgebraKit = "0.5"
4545
SparseArraysBase = "0.7.1"
4646
SplitApplyCombine = "1.2.3"
4747
TensorAlgebra = "0.3, 0.4"

src/factorizations/orthnull.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function MatrixAlgebraKit.left_null_svd!(
147147
)
148148
return left_null_svd!(A, N, alg, null_truncation_strategy(; atol=0, rtol=0))
149149
end
150-
function MatrixAlgebraKit.truncate!(
150+
function MatrixAlgebraKit.truncate(
151151
::typeof(left_null!),
152152
(U, S)::Tuple{AbstractBlockSparseMatrix,AbstractBlockSparseMatrix},
153153
strategy::TruncationStrategy,
@@ -166,9 +166,9 @@ function MatrixAlgebraKit.check_input(
166166
return nothing
167167
end
168168
function MatrixAlgebraKit.right_null_lq!(A::AbstractBlockSparseMatrix, N, alg)
169-
return error("Not implement.")
169+
return error("Not implemented.")
170170
end
171-
function MatrixAlgebraKit.truncate!(
171+
function MatrixAlgebraKit.truncate(
172172
::typeof(right_null!),
173173
(S, Vᴴ)::Tuple{AbstractBlockSparseMatrix,AbstractBlockSparseMatrix},
174174
strategy::TruncationStrategy,

src/factorizations/truncation.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using MatrixAlgebraKit:
77
eigh_trunc!,
88
findtruncated,
99
svd_trunc!,
10-
truncate!
10+
truncate
1111

1212
"""
1313
BlockDiagonalTruncationStrategy(strategy::TruncationStrategy)
@@ -41,12 +41,12 @@ end
4141

4242
for f in [:eig_trunc!, :eigh_trunc!]
4343
@eval begin
44-
function MatrixAlgebraKit.truncate!(
44+
function MatrixAlgebraKit.truncate(
4545
::typeof($f),
4646
(D, V)::NTuple{2,AbstractBlockSparseMatrix},
4747
strategy::TruncationStrategy,
4848
)
49-
return truncate!($f, (D, V), BlockDiagonalTruncationStrategy(strategy))
49+
return truncate($f, (D, V), BlockDiagonalTruncationStrategy(strategy))
5050
end
5151
end
5252
end
@@ -74,23 +74,23 @@ function to_truncated_indices(values::AbstractBlockVector, I::AbstractVector{Boo
7474
return blocks
7575
end
7676

77-
function MatrixAlgebraKit.truncate!(
77+
function MatrixAlgebraKit.truncate(
7878
::typeof(svd_trunc!),
7979
(U, S, Vᴴ)::NTuple{3,AbstractBlockSparseMatrix},
8080
strategy::BlockDiagonalTruncationStrategy,
8181
)
8282
I = findtruncated(diag(S), strategy)
83-
return (U[:, I], S[I, I], Vᴴ[I, :])
83+
return (U[:, I], S[I, I], Vᴴ[I, :]), I
8484
end
8585
for f in [:eig_trunc!, :eigh_trunc!]
8686
@eval begin
87-
function MatrixAlgebraKit.truncate!(
87+
function MatrixAlgebraKit.truncate(
8888
::typeof($f),
8989
(D, V)::NTuple{2,AbstractBlockSparseMatrix},
9090
strategy::BlockDiagonalTruncationStrategy,
9191
)
9292
I = findtruncated(diag(D), strategy)
93-
return (D[I, I], V[:, I])
93+
return (D[I, I], V[:, I]), I
9494
end
9595
end
9696
end

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ DiagonalArrays = "0.3"
3131
GPUArraysCore = "0.2"
3232
JLArrays = "0.2"
3333
LinearAlgebra = "1"
34-
MatrixAlgebraKit = "0.4"
34+
MatrixAlgebraKit = "0.5"
3535
Random = "1"
3636
SafeTestsets = "0.1"
3737
SparseArraysBase = "0.7"

0 commit comments

Comments
 (0)