Skip to content

Commit ae04047

Browse files
committed
remove redundant islinear function, add == tests
1 parent a3779ff commit ae04047

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/Utilities.jl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export create_encoder_schedule,
2828
decode_data,
2929
decode_structure_matrix,
3030
norm,
31+
isequal_linear,
3132
encoder_kwargs_from
3233

3334

@@ -276,14 +277,6 @@ function isequal_linear(
276277
return true
277278
end
278279

279-
function isequal_linear(A::AMorV1, B::AMorV2; kwargs...) where {AMorV1 <: AbstractVecOrMat, AMorV2 <: AbstractVecOrMat}
280-
if !(size(A) == size(B))
281-
return false
282-
end
283-
284-
return all(isequal_linear(a, b; kwargs...) for (a, b) in zip(A[:], B[:]))
285-
end
286-
287280
function Base.:(==)(a::LM1, b::LM2) where {LM1 <: LinearMap, LM2 <: LinearMap}
288281
n = size(a, 2)
289282
if n < 1e4 # gets expensive

test/Utilities/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ end
104104
A[4].svd_cov.U * Diagonal(A[4].svd_cov.S) * A[4].svd_cov.Vt + A[4].diag_cov
105105
106106
107+
@test_throws ArgumentError create_compact_linear_map(3 * I) # needs dims
108+
107109
for svd_type in ["psvd", "tsvd"]
108110
psvd_kwargs = (; rtol = 1e-3) # make very small for testing
109111
tsvd_max_rank = 30 # often only stable small ranks
@@ -116,6 +118,11 @@ end
116118
)
117119
Amat_from_map = Matrix(Amap)
118120
121+
# some extra tests for the ==/is_equal overrides
122+
@test Amap == Amap
123+
Amap2 = create_compact_linear_map([A[1]])
124+
@test !(Amap == Amap2)
125+
119126
for (i, ids) in enumerate(block_id)
120127
if i == 2 # the case where we do psvd on a full matrix - can be very high error expected (particularly tsvd
121128
if svd_type == "psvd"

0 commit comments

Comments
 (0)