Skip to content

Commit 18b7421

Browse files
author
Katharine Hyatt
committed
Respond to comments
1 parent 08b8321 commit 18b7421

File tree

3 files changed

+5
-12
lines changed

3 files changed

+5
-12
lines changed

src/auxiliary/linalg.jl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,5 @@ Base.adjoint(alg::Union{SVD,SDD,Polar}) = alg
4646
const OFA = OrthogonalFactorizationAlgorithm
4747
const SVDAlg = Union{SVD,SDD}
4848

49-
function one!(A::StridedMatrix)
50-
length(A) > 0 || return A
51-
copyto!(A, LinearAlgebra.I)
52-
return A
53-
end
54-
5549
safesign(s::Real) = ifelse(s < zero(s), -one(s), +one(s))
5650
safesign(s::Complex) = ifelse(iszero(s), one(s), s / abs(s))
57-
58-
_argmax(f, domain) = argmax(f, domain)

src/tensors/factorizations/factorizations.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export eig, eig!, eigh, eigh!
77
export tsvd, tsvd!, svdvals, svdvals!
88
export leftorth, leftorth!, rightorth, rightorth!
99
export leftnull, leftnull!, rightnull, rightnull!
10-
export copy_oftype, permutedcopy_oftype
10+
export copy_oftype, permutedcopy_oftype, one!
1111
export TruncationScheme, notrunc, truncbelow, truncerr, truncdim, truncspace
1212

1313
using ..TensorKit
14-
using ..TensorKit: AdjointTensorMap, SectorDict, OFA, blocktype, foreachblock
14+
using ..TensorKit: AdjointTensorMap, SectorDict, OFA, blocktype, foreachblock, one!
1515

1616
using LinearAlgebra: LinearAlgebra, BlasFloat, Diagonal, svdvals, svdvals!
1717
import LinearAlgebra: eigen, eigen!, isposdef, isposdef!, ishermitian
@@ -41,6 +41,8 @@ include("matrixalgebrakit.jl")
4141
include("truncation.jl")
4242
include("deprecations.jl")
4343

44+
TensorKit.one!(A::AbstractMatrix) = MatrixAlgebraKit.one!(A)
45+
4446
function isisometry(t::AbstractTensorMap, (p₁, p₂)::Index2Tuple)
4547
t = permute(t, (p₁, p₂); copy=false)
4648
return isisometry(t)

test/ad.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,7 @@ Vlist = ((ℂ^2, (ℂ^3)', ℂ^3, ℂ^2, (ℂ^2)'),
447447
T <: Complex && remove_svdgauge_depence!(ΔU, ΔV, U, S, V)
448448
test_rrule(tsvd, C; atol, output_tangent=(ΔU, ΔS, ΔV))
449449

450-
c, = TensorKit._argmax(x -> sqrt(dim(x[1])) * maximum(diag(x[2])),
451-
blocks(S))
450+
c, = argmax(x -> sqrt(dim(x[1])) * maximum(diag(x[2])), blocks(S))
452451
trunc = truncdim(round(Int, 2 * dim(c)))
453452
U, S, V = tsvd(C; trunc)
454453
ΔU = randn(scalartype(U), space(U))

0 commit comments

Comments
 (0)