Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ GPUArraysCore = "0.1, 0.2"
LinearAlgebra = "1.10"
MacroTools = "0.5.13"
MapBroadcast = "0.1.5"
MatrixAlgebraKit = "0.2.2, 0.3, 0.4"
MatrixAlgebraKit = "0.5"
SparseArraysBase = "0.7.1"
SplitApplyCombine = "1.2.3"
TensorAlgebra = "0.3, 0.4"
Expand Down
4 changes: 2 additions & 2 deletions src/factorizations/orthnull.jl
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ function MatrixAlgebraKit.left_null_svd!(
)
return left_null_svd!(A, N, alg, null_truncation_strategy(; atol = 0, rtol = 0))
end
function MatrixAlgebraKit.truncate!(
function MatrixAlgebraKit.truncate(
::typeof(left_null!),
(U, S)::Tuple{AbstractBlockSparseMatrix, AbstractBlockSparseMatrix},
(U, S)::Tuple{AbstractBlockSparseMatrix,AbstractBlockSparseMatrix},
strategy::TruncationStrategy,
)
return error("Not implemented.")
Expand Down
14 changes: 7 additions & 7 deletions src/factorizations/truncation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using MatrixAlgebraKit:
eigh_trunc!,
findtruncated,
svd_trunc!,
truncate!
truncate

"""
BlockDiagonalTruncationStrategy(strategy::TruncationStrategy)
Expand Down Expand Up @@ -41,12 +41,12 @@ end

for f in [:eig_trunc!, :eigh_trunc!]
@eval begin
function MatrixAlgebraKit.truncate!(
function MatrixAlgebraKit.truncate(
::typeof($f),
(D, V)::NTuple{2, AbstractBlockSparseMatrix},
strategy::TruncationStrategy,
)
return truncate!($f, (D, V), BlockDiagonalTruncationStrategy(strategy))
return truncate($f, (D, V), BlockDiagonalTruncationStrategy(strategy))
end
end
end
Expand Down Expand Up @@ -74,23 +74,23 @@ function to_truncated_indices(values::AbstractBlockVector, I::AbstractVector{Boo
return blocks
end

function MatrixAlgebraKit.truncate!(
function MatrixAlgebraKit.truncate(
::typeof(svd_trunc!),
(U, S, Vᴴ)::NTuple{3, AbstractBlockSparseMatrix},
strategy::BlockDiagonalTruncationStrategy,
)
I = findtruncated(diag(S), strategy)
return (U[:, I], S[I, I], Vᴴ[I, :])
return (U[:, I], S[I, I], Vᴴ[I, :]), I
end
for f in [:eig_trunc!, :eigh_trunc!]
@eval begin
function MatrixAlgebraKit.truncate!(
function MatrixAlgebraKit.truncate(
::typeof($f),
(D, V)::NTuple{2, AbstractBlockSparseMatrix},
strategy::BlockDiagonalTruncationStrategy,
)
I = findtruncated(diag(D), strategy)
return (D[I, I], V[:, I])
return (D[I, I], V[:, I]), I
end
end
end
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ DiagonalArrays = "0.3"
GPUArraysCore = "0.2"
JLArrays = "0.2"
LinearAlgebra = "1"
MatrixAlgebraKit = "0.4"
MatrixAlgebraKit = "0.5"
Random = "1"
SafeTestsets = "0.1"
SparseArraysBase = "0.7"
Expand Down
Loading