Skip to content

Commit

Permalink
Add some more Kronecker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanaelbosch committed Feb 18, 2024
1 parent a9f24d7 commit a2d527a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/kronecker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ _matmul!(
return A
end

mul!(A::IKP, b::Number, C::IKP) = begin
check_matmul_sizes(A, C)
mul!(A.B, b, C.B)
return A
end
mul!(A::IKP, B::IKP, c::Number) = begin
check_matmul_sizes(A, B)
mul!(A.B, B.B, c)
return A
end
_matmul!(A::IKP, b::Number, C::IKP) = begin
check_matmul_sizes(A, C)
_matmul!(A.B, b, C.B)
Expand Down
6 changes: 6 additions & 0 deletions test/core/kronecker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ q = 2
@test α * K1 isa PNDE.IsometricKroneckerProduct
@test K1 * α α * M1
@test K1 * α isa PNDE.IsometricKroneckerProduct
_K1 = copy(K1)
@test mul!(_K1, α, K1) == α * K1
@test mul!(_K1, K1, α) == α * K1
@test _matmul!(_K1, K1, α) == α * K1
@test _matmul!(_K1, α, K1) == α * K1


# In-place Matrix-Matrix Multiplication
β = -0.5
Expand Down

0 comments on commit a2d527a

Please sign in to comment.