Skip to content

Commit ea250bb

Browse files
authored
Simplify default_algorithm logic based on MatrixAlgebraKit v0.2.2 (#133)
1 parent f42daa9 commit ea250bb

File tree

5 files changed

+2
-96
lines changed

5 files changed

+2
-96
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BlockSparseArrays"
22
uuid = "2c9a651f-6452-4ace-a6ac-809f4280fbb4"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.7.0"
4+
version = "0.7.1"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
@@ -39,7 +39,7 @@ GPUArraysCore = "0.1.0, 0.2"
3939
LinearAlgebra = "1.10"
4040
MacroTools = "0.5.13"
4141
MapBroadcast = "0.1.5"
42-
MatrixAlgebraKit = "0.2"
42+
MatrixAlgebraKit = "0.2.2"
4343
SparseArraysBase = "0.5"
4444
SplitApplyCombine = "1.2.3"
4545
TensorAlgebra = "0.3.2"

src/factorizations/lq.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,5 @@
11
using MatrixAlgebraKit: MatrixAlgebraKit, default_lq_algorithm, lq_compact!, lq_full!
22

3-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
4-
function MatrixAlgebraKit.default_lq_algorithm(A::AbstractBlockSparseMatrix; kwargs...)
5-
return default_lq_algorithm(typeof(A); kwargs...)
6-
end
7-
8-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
9-
function MatrixAlgebraKit.default_algorithm(
10-
::typeof(lq_compact!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
11-
)
12-
return default_lq_algorithm(A; kwargs...)
13-
end
14-
15-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
16-
function MatrixAlgebraKit.default_algorithm(
17-
::typeof(lq_full!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
18-
)
19-
return default_lq_algorithm(A; kwargs...)
20-
end
21-
223
function MatrixAlgebraKit.default_lq_algorithm(
234
A::Type{<:AbstractBlockSparseMatrix}; kwargs...
245
)

src/factorizations/polar.jl

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,6 @@ using MatrixAlgebraKit:
77
right_polar!,
88
svd_compact!
99

10-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
11-
function MatrixAlgebraKit.default_algorithm(
12-
::typeof(left_polar!), A::AbstractBlockSparseMatrix; kwargs...
13-
)
14-
return default_algorithm(left_polar!, typeof(A); kwargs...)
15-
end
16-
17-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
18-
function MatrixAlgebraKit.default_algorithm(
19-
::typeof(left_polar!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
20-
)
21-
return PolarViaSVD(default_algorithm(svd_compact!, A; kwargs...))
22-
end
23-
24-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
25-
function MatrixAlgebraKit.default_algorithm(
26-
::typeof(right_polar!), A::AbstractBlockSparseMatrix; kwargs...
27-
)
28-
return default_algorithm(right_polar!, typeof(A); kwargs...)
29-
end
30-
31-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
32-
function MatrixAlgebraKit.default_algorithm(
33-
::typeof(right_polar!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
34-
)
35-
return PolarViaSVD(default_algorithm(svd_compact!, A; kwargs...))
36-
end
37-
3810
function MatrixAlgebraKit.check_input(::typeof(left_polar!), A::AbstractBlockSparseMatrix)
3911
@views for I in eachblockstoredindex(A)
4012
m, n = size(A[I])

src/factorizations/qr.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
using MatrixAlgebraKit:
22
MatrixAlgebraKit, default_qr_algorithm, lq_compact!, lq_full!, qr_compact!, qr_full!
33

4-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
5-
function MatrixAlgebraKit.default_qr_algorithm(A::AbstractBlockSparseMatrix; kwargs...)
6-
return default_qr_algorithm(typeof(A); kwargs...)
7-
end
8-
9-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
10-
function MatrixAlgebraKit.default_algorithm(
11-
::typeof(qr_compact!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
12-
)
13-
return default_qr_algorithm(A; kwargs...)
14-
end
15-
16-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
17-
function MatrixAlgebraKit.default_algorithm(
18-
::typeof(qr_full!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
19-
)
20-
return default_qr_algorithm(A; kwargs...)
21-
end
22-
234
function MatrixAlgebraKit.default_qr_algorithm(
245
A::Type{<:AbstractBlockSparseMatrix}; kwargs...
256
)

src/factorizations/svd.jl

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
using MatrixAlgebraKit: MatrixAlgebraKit, default_svd_algorithm, svd_compact!, svd_full!
22

3-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
4-
using MatrixAlgebraKit: TruncatedAlgorithm, select_truncation, svd_trunc!
5-
function MatrixAlgebraKit.select_algorithm(
6-
::typeof(svd_trunc!), A::Type{<:AbstractBlockSparseMatrix}, alg; trunc=nothing, kwargs...
7-
)
8-
alg_svd = select_algorithm(svd_compact!, A, alg; kwargs...)
9-
return TruncatedAlgorithm(alg_svd, select_truncation(trunc))
10-
end
11-
123
"""
134
BlockPermutedDiagonalAlgorithm(A::MatrixAlgebraKit.AbstractAlgorithm)
145
@@ -21,25 +12,6 @@ struct BlockPermutedDiagonalAlgorithm{A<:MatrixAlgebraKit.AbstractAlgorithm} <:
2112
alg::A
2213
end
2314

24-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
25-
function MatrixAlgebraKit.default_svd_algorithm(A::AbstractBlockSparseMatrix; kwargs...)
26-
return default_svd_algorithm(typeof(A), kwargs...)
27-
end
28-
29-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
30-
function MatrixAlgebraKit.default_algorithm(
31-
f::typeof(svd_compact!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
32-
)
33-
return default_svd_algorithm(A; kwargs...)
34-
end
35-
36-
# TODO: Delete once https://github.com/QuantumKitHub/MatrixAlgebraKit.jl/pull/32 is merged.
37-
function MatrixAlgebraKit.default_algorithm(
38-
f::typeof(svd_full!), A::Type{<:AbstractBlockSparseMatrix}; kwargs...
39-
)
40-
return default_svd_algorithm(A; kwargs...)
41-
end
42-
4315
function MatrixAlgebraKit.default_svd_algorithm(
4416
A::Type{<:AbstractBlockSparseMatrix}; kwargs...
4517
)

0 commit comments

Comments
 (0)