Skip to content

Commit a0f6153

Browse files
committed
purge some more constructors
1 parent 637e890 commit a0f6153

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

src/factorizations/diagonal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function MAK.initialize_output(
7272
V_cod = fuse(codomain(t))
7373
V_dom = fuse(domain(t))
7474
U = similar(t, codomain(t) V_cod)
75-
S = similar_diagonal(t, real(scalartype(t)), V_cod V_dom)
75+
S = similar_diagonal(t, real(scalartype(t)), V_cod)
7676
Vᴴ = similar(t, V_dom domain(t))
7777
return U, S, Vᴴ
7878
end

src/tensors/abstracttensor.jl

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -547,17 +547,15 @@ end
547547

548548
# similar diagonal
549549
# ----------------
550-
# The implementation is again written for similar_diagonal(t, TorA, V::TensorSpace) -> DiagonalTensorMap
550+
# The implementation is again written for similar_diagonal(t, TorA, V::ElementarySpace) -> DiagonalTensorMap
551551
# and all other methods are just filling in default arguments
552552
@doc """
553-
similar_diagonal(t::AbstractTensorMap, [AorT=storagetype(t)], [V=space(t)])
554-
similar_diagonal(t::AbstractTensorMap, [AorT=storagetype(t)], codomain, domain)
553+
similar_diagonal(t::AbstractTensorMap, [AorT=storagetype(t)], [V::ElementarySpace])
555554
556555
Creates an uninitialized mutable diagonal tensor with the given scalar or storagetype `AorT` and
557-
structure `V` or `codomain ← domain`, based on the source tensormap. The second and third
558-
arguments are both optional, defaulting to the given tensor's `storagetype` and `space`.
559-
The structure may be specified either as a single `HomSpace` argument or as `codomain` and
560-
`domain`.
556+
structure `V ← V`, based on the source tensormap. The second argument is optional and defaults
557+
to the given tensor's `storagetype`, while the third argument can only be omitted for square
558+
input tensors of space `V ← V`, to conform with the diagonal structure.
561559
562560
By default, this will result in `DiagonalTensorMap{T}(undef, V)` when custom objects do not
563561
specialize this method. Furthermore, the method will throw if the provided space is not compatible
@@ -566,23 +564,7 @@ with a diagonal structure.
566564
See also [`Base.similar`](@ref).
567565
""" similar_diagonal(::AbstractTensorMap, args...)
568566

569-
# 4 arguments
570-
function similar_diagonal(t::AbstractTensorMap, ::Type{T}, cod::TensorSpace, dom::TensorSpace) where {T}
571-
length(cod) == length(dom) == 1 && cod == dom ||
572-
throw(ArgumentError("requested space is not square"))
573-
return similar_diagonal(t, T, cod)
574-
end
575-
576567
# 3 arguments
577-
function similar_diagonal(t::AbstractTensorMap, ::Type{T}, V::TensorMapSpace) where {T}
578-
numout(V) == numin(V) == 1 && domain(V) == codomain(V) ||
579-
throw(ArgumentError("requested space is not square"))
580-
return similar_diagonal(t, T, codomain(V))
581-
end
582-
function similar_diagonal(t::AbstractTensorMap, ::Type{T}, V::ProductSpace) where {T}
583-
length(V) == 1 || throw(ArgumentError())
584-
return similar_diagonal(t, T, only(V.spaces))
585-
end
586568
function similar_diagonal(t::AbstractTensorMap, ::Type{TorA}, V::ElementarySpace) where {TorA}
587569
if TorA <: Number
588570
T = TorA

0 commit comments

Comments
 (0)