Skip to content

Commit 6ff0835

Browse files
committed
improve deprecation
1 parent 8a97299 commit 6ff0835

File tree

8 files changed

+133
-271
lines changed

8 files changed

+133
-271
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TensorKit"
22
uuid = "07d1fe3e-3e46-537d-9eac-e9e13d0d4cec"
33
authors = ["Jutho Haegeman"]
4-
version = "0.14.11"
4+
version = "0.15.0-DEV"
55

66
[deps]
77
LRUCache = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637"

src/TensorKit.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ include("auxiliary/auxiliary.jl")
148148
include("auxiliary/caches.jl")
149149
include("auxiliary/dicts.jl")
150150
include("auxiliary/iterators.jl")
151-
include("auxiliary/linalg.jl")
152151
include("auxiliary/random.jl")
153152

154153
#--------------------------------------------------------------------

src/auxiliary/linalg.jl

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,3 @@
22
#------------------------------------------------------
33
set_num_blas_threads(n::Integer) = LinearAlgebra.BLAS.set_num_threads(n)
44
get_num_blas_threads() = LinearAlgebra.BLAS.get_num_threads()
5-
6-
# Factorization algorithms
7-
#--------------------------
8-
abstract type FactorizationAlgorithm end
9-
abstract type OrthogonalFactorizationAlgorithm <: FactorizationAlgorithm end
10-
11-
struct QRpos <: OrthogonalFactorizationAlgorithm
12-
end
13-
struct QR <: OrthogonalFactorizationAlgorithm
14-
end
15-
struct QL <: OrthogonalFactorizationAlgorithm
16-
end
17-
struct QLpos <: OrthogonalFactorizationAlgorithm
18-
end
19-
struct LQ <: OrthogonalFactorizationAlgorithm
20-
end
21-
struct LQpos <: OrthogonalFactorizationAlgorithm
22-
end
23-
struct RQ <: OrthogonalFactorizationAlgorithm
24-
end
25-
struct RQpos <: OrthogonalFactorizationAlgorithm
26-
end
27-
struct SDD <: OrthogonalFactorizationAlgorithm # lapack's default divide and conquer algorithm
28-
end
29-
struct SVD <: OrthogonalFactorizationAlgorithm
30-
end
31-
struct Polar <: OrthogonalFactorizationAlgorithm
32-
end
33-
34-
Base.adjoint(::QRpos) = LQpos()
35-
Base.adjoint(::QR) = LQ()
36-
Base.adjoint(::LQpos) = QRpos()
37-
Base.adjoint(::LQ) = QR()
38-
39-
Base.adjoint(::QLpos) = RQpos()
40-
Base.adjoint(::QL) = RQ()
41-
Base.adjoint(::RQpos) = QLpos()
42-
Base.adjoint(::RQ) = QL()
43-
44-
Base.adjoint(alg::Union{SVD,SDD,Polar}) = alg
45-
46-
const OFA = OrthogonalFactorizationAlgorithm
47-
const SVDAlg = Union{SVD,SDD}

src/auxiliary/random.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ function randisometry!(rng::Random.AbstractRNG, A::AbstractMatrix)
2020
dims = size(A)
2121
dims[1] >= dims[2] ||
2222
throw(DimensionMismatch("cannot create isometric matrix with dimensions $dims; isometry needs to be tall or square"))
23-
Q, = leftorth!(Random.randn!(rng, A); alg=QRpos())
23+
Q, = qr_compact!(Random.randn!(rng, A); positive=true)
2424
return copy!(A, Q)
2525
end
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,128 @@
1+
# Factorization structs
2+
@deprecate QR() LAPACK_HouseholderQR()
3+
@deprecate QRpos() LAPACK_HouseholderQR(; positive=true)
14

5+
@deprecate QL() LAPACK_HouseholderQL()
6+
@deprecate QLpos() LAPACK_HouseholderQL(; positive=true)
7+
8+
@deprecate LQ() LAPACK_HouseholderLQ()
9+
@deprecate LQpos() LAPACK_HouseholderLQ(; positive=true)
10+
11+
@deprecate RQ() LAPACK_HouseholderRQ()
12+
@deprecate RQpos() LAPACK_HouseholderRQ(; positive=true)
13+
14+
@deprecate SDD() LAPACK_DivideAndConquer()
15+
@deprecate SVD() LAPACK_QRIteration()
16+
17+
@deprecate Polar() PolarViaSVD(LAPACK_DivideAndConquer())
18+
19+
# truncations
20+
const TruncationScheme = TruncationStrategy
21+
@deprecate truncdim(d::Int) truncrank(d)
22+
@deprecate truncbelow::Real) trunctol(ϵ)
23+
24+
# factorizations
25+
# --------------
26+
# orthogonalization
27+
@deprecate(leftorth(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
28+
leftorth!(permutedcopy_oftype(t, factorization_scalartype(leftorth, t), p);
29+
kwargs...))
30+
@deprecate(rightorth(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
31+
rightorth!(permutedcopy_oftype(t, factorisation_scalartype(rightorth, t), p);
32+
kwargs...))
33+
function leftorth(t::AbstractTensorMap; kwargs...)
34+
Base.depwarn("`leftorth` is no longer supported, use `left_orth` instead", :leftorth)
35+
return left_orth(t; kwargs...)
36+
end
37+
function leftorth!(t::AbstractTensorMap; kwargs...)
38+
Base.depwarn("`leftorth!` is no longer supported, use `left_orth!` instead", :leftorth!)
39+
return left_orth!(t; kwargs...)
40+
end
41+
function rightorth(t::AbstractTensorMap; kwargs...)
42+
Base.depwarn("`rightorth` is no longer supported, use `right_orth` instead", :rightorth)
43+
return right_orth(t; kwargs...)
44+
end
45+
function rightorth!(t::AbstractTensorMap; kwargs...)
46+
Base.depwarn("`rightorth!` is no longer supported, use `right_orth!` instead",
47+
:rightorth!)
48+
return right_orth!(t; kwargs...)
49+
end
50+
51+
# nullspaces
52+
@deprecate(leftnull(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
53+
leftnull!(permutedcopy_oftype(t, factorization_scalartype(leftnull, t), p);
54+
kwargs...))
55+
@deprecate(rightnull(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
56+
rightnull!(permutedcopy_oftype(t, factorisation_scalartype(rightnull, t), p);
57+
kwargs...))
58+
function leftnull(t::AbstractTensorMap; kwargs...)
59+
Base.depwarn("`leftnull` is no longer supported, use `left_null` instead", :leftnull)
60+
return left_null(t; kwargs...)
61+
end
62+
function leftnull!(t::AbstractTensorMap; kwargs...)
63+
Base.depwarn("`left_null!` is no longer supported, use `left_null!` instead",
64+
:leftnull!)
65+
return left_null!(t; kwargs...)
66+
end
67+
function rightnull(t::AbstractTensorMap; kwargs...)
68+
Base.depwarn("`rightnull` is no longer supported, use `right_null` instead", :rightnull)
69+
return right_null(t; kwargs...)
70+
end
71+
function rightnull!(t::AbstractTensorMap; kwargs...)
72+
Base.depwarn("`rightnull!` is no longer supported, use `right_null!` instead",
73+
:rightnull!)
74+
return right_null!(t; kwargs...)
75+
end
76+
77+
# eigen values
78+
@deprecate(eig(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
79+
eig!(permutedcopy_oftype(t, factorisation_scalartype(eig, t), p); kwargs...))
80+
@deprecate(eigh(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
81+
eigh!(permutedcopy_oftype(t, factorisation_scalartype(eigen, t), p); kwargs...))
82+
@deprecate(eigen(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
83+
eigen!(permutedcopy_oftype(t, factorisation_scalartype(eigen, t), p); kwargs...))
84+
function eig(t::AbstractTensorMap; kwargs...)
85+
Base.depwarn("`eig` is no longer supported, use `eig_full` or `eig_trunc` instead",
86+
:eig)
87+
return haskey(kwargs, :trunc) ? eig_trunc(t; kwargs...) : eig_full(t; kwargs...)
88+
end
89+
function eig!(t::AbstractTensorMap; kwargs...)
90+
Base.depwarn("`eig!` is no longer supported, use `eig_full!` or `eig_trunc!` instead",
91+
:eig!)
92+
return haskey(kwargs, :trunc) ? eig_trunc!(t; kwargs...) : eig_full!(t; kwargs...)
93+
end
94+
function eigh(t::AbstractTensorMap; kwargs...)
95+
Base.depwarn("`eigh` is no longer supported, use `eigh_full` or `eigh_trunc` instead",
96+
:eigh)
97+
return haskey(kwargs, :trunc) ? eigh_trunc(t; kwargs...) : eigh_full(t; kwargs...)
98+
end
99+
function eigh!(t::AbstractTensorMap; kwargs...)
100+
Base.depwarn("`eigh!` is no longer supported, use `eigh_full!` or `eigh_trunc!` instead",
101+
:eigh!)
102+
return haskey(kwargs, :trunc) ? eigh_trunc!(t; kwargs...) : eigh_full!(t; kwargs...)
103+
end
104+
105+
# singular values
106+
_drop_p(; p=nothing, kwargs...) = kwargs
107+
@deprecate(tsvd(t::AbstractTensorMap, p::Index2Tuple; kwargs...),
108+
tsvd!(permutedcopy_oftype(t, factorisation_scalartype(tsvd, t), p); kwargs...))
109+
function tsvd(t::AbstractTensorMap; kwargs...)
110+
Base.depwarn("`tsvd` is no longer supported, use `svd_compact`, `svd_full` or `svd_trunc` instead",
111+
:tsvd)
112+
if haskey(kwargs, :p)
113+
Base.depwarn("p is no longer a supported kwarg, and should be specified through the truncation strategy",
114+
:tsvd)
115+
kwargs = _drop_p(; kwargs...)
116+
end
117+
return haskey(kwargs, :trunc) ? svd_trunc(t; kwargs...) : svd_compact(t; kwargs...)
118+
end
119+
function tsvd!(t::AbstractTensorMap; kwargs...)
120+
Base.depwarn("`tsvd!` is no longer supported, use `svd_compact!`, `svd_full!` or `svd_trunc!` instead",
121+
:tsvd!)
122+
if haskey(kwargs, :p)
123+
Base.depwarn("p is no longer a supported kwarg, and should be specified through the truncation strategy",
124+
:tsvd!)
125+
kwargs = _drop_p(; kwargs...)
126+
end
127+
return haskey(kwargs, :trunc) ? svd_trunc!(t; kwargs...) : svd_compact!(t; kwargs...)
128+
end

src/tensors/factorizations/factorizations.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export copy_oftype, permutedcopy_oftype, one!
1515
export TruncationScheme, notrunc, truncbelow, truncerr, truncdim, truncspace, PolarViaSVD
1616

1717
using ..TensorKit
18-
using ..TensorKit: AdjointTensorMap, SectorDict, OFA, blocktype, foreachblock, one!
18+
using ..TensorKit: AdjointTensorMap, SectorDict, blocktype, foreachblock, one!
1919

2020
using LinearAlgebra: LinearAlgebra, BlasFloat, Diagonal, svdvals, svdvals!
2121
import LinearAlgebra: eigen, eigen!, isposdef, isposdef!, ishermitian
@@ -27,7 +27,8 @@ using MatrixAlgebraKit: AbstractAlgorithm, TruncatedAlgorithm, TruncationStrateg
2727
NoTruncation, TruncationKeepAbove, TruncationKeepBelow,
2828
TruncationIntersection, TruncationKeepFiltered, PolarViaSVD,
2929
LAPACK_SVDAlgorithm, LAPACK_QRIteration, LAPACK_HouseholderQR,
30-
LAPACK_HouseholderLQ, DiagonalAlgorithm
30+
LAPACK_HouseholderLQ, LAPACK_HouseholderQL, LAPACK_HouseholderRQ,
31+
DiagonalAlgorithm
3132
import MatrixAlgebraKit: default_algorithm,
3233
copy_input, check_input, initialize_output,
3334
qr_compact!, qr_full!, qr_null!, lq_compact!, lq_full!, lq_null!,
@@ -42,7 +43,7 @@ import MatrixAlgebraKit: default_algorithm,
4243

4344
include("utility.jl")
4445
include("interface.jl")
45-
include("implementations.jl")
46+
# include("implementations.jl")
4647
include("matrixalgebrakit.jl")
4748
include("truncation.jl")
4849
include("deprecations.jl")

0 commit comments

Comments
 (0)