Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions src/tensors/linalg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ for f in (:cos, :sin, :tan, :cot, :cosh, :sinh, :tanh, :coth, :atan, :acot, :asi
sf = string(f)
@eval function Base.$f(t::AbstractTensorMap)
domain(t) == codomain(t) ||
error("$sf of a tensor only exist when domain == codomain.")
throw(SpaceMismatch("`$($sf)` of a tensor only exist when domain == codomain"))
T = float(scalartype(t))
tf = similar(t, T)
if T <: Real
Expand All @@ -464,7 +464,7 @@ for f in (:sqrt, :log, :asin, :acos, :acosh, :atanh, :acoth)
sf = string(f)
@eval function Base.$f(t::AbstractTensorMap)
domain(t) == codomain(t) ||
error("$sf of a tensor only exist when domain == codomain.")
throw(SpaceMismatch("`$($sf)` of a tensor only exist when domain == codomain"))
T = complex(float(scalartype(t)))
tf = similar(t, T)
for (c, b) in blocks(t)
Expand Down
6 changes: 6 additions & 0 deletions test/tensors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,12 @@ for V in spacelist
@test tanh(@constinferred atanh(t7)) ≈ t7
t8 = coth(t)
@test coth(@constinferred acoth(t8)) ≈ t8
t = randn(T, W, V1) # not square
for f in
(cos, sin, tan, cot, cosh, sinh, tanh, coth, atan, acot, asinh,
sqrt, log, asin, acos, acosh, atanh, acoth)
@test_throws SpaceMismatch f(t)
end
end
end
end
Expand Down
Loading