Skip to content
Merged
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
21 changes: 21 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ end
@test D' * M ≈ D' * Mf
@test M * E' ≈ Mf * E'
@test E * M' ≈ E * Mf'
@test size(Mf, 1) == 15
@test size(Mf, 2) == 10
@test size(Mf, 3) == 1
@test length(Mf) == 150
@test similar(Mf, (3, 4)) isa Matrix{eltype(U)}
@test similar(Mf, Int, (3, 4)) isa Matrix{Int}
@test !any(isnan, Mf)
@test !any(isinf, Mf)
V1, U1 = [1; 1;;], [1 -1]
Expand Down Expand Up @@ -203,6 +209,21 @@ end
check_fmfm_fm_alloc(Mf, Mf_A, ws3x3, Cf15x8)
end

# mul! FM×FM→FM: elseif branch (k-rank output) and DimensionMismatch
let
Ua = myrand(T, 15, 2); Va = myrand(T, 2, 10)
Ub = myrand(T, 10, 3); Vb = myrand(T, 3, 8)
Af = FactoredMatrix(Ua, Va); Bf = FactoredMatrix(Ub, Vb)
expected = (Ua * Va) * (Ub * Vb)
# k-rank output (C rank = k = 2)
Ck = FactoredMatrix(Matrix{T}(undef, 15, 2), Matrix{T}(undef, 2, 8))
mul!(Ck, Af, Bf)
@test Array(Ck) ≈ expected
# wrong rank → DimensionMismatch
Cbad = FactoredMatrix(Matrix{T}(undef, 15, 4), Matrix{T}(undef, 4, 8))
@test_throws DimensionMismatch("C's factorization size doesn't match the result of A*B") mul!(Cbad, Af, Bf)
end

# mul! vector (with and without cache)
let
b = vec(myrand(T, 10, 1))
Expand Down
Loading