-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix complex dense-perm matmul * bump version * fix test * fix nightly test
- Loading branch information
Showing
5 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
using Test, Random, SparseArrays, LinearAlgebra | ||
import LuxurySparse: IMatrix, PermMatrix | ||
|
||
Random.seed!(2) | ||
@testset "kron" begin | ||
Random.seed!(2) | ||
|
||
p1 = IMatrix{4}() | ||
sp = sprand(ComplexF64, 4, 4, 0.5) | ||
ds = rand(ComplexF64, 4, 4) | ||
pm = PermMatrix([2, 3, 4, 1], randn(4)) | ||
v = [0.5, 0.3im, 0.2, 1.0] | ||
dv = Diagonal(v) | ||
p1 = IMatrix{4}() | ||
sp = sprand(ComplexF64, 4, 4, 0.5) | ||
ds = rand(ComplexF64, 4, 4) | ||
pm = PermMatrix([2, 3, 4, 1], randn(4)) | ||
pm = PermMatrix([2, 3, 4, 1], randn(4)) | ||
v = [0.5, 0.3im, 0.2, 1.0] | ||
dv = Diagonal(v) | ||
|
||
|
||
@testset "kron(::$(typeof(source)), ::$(typeof(target)))" for source in [p1, sp, ds, dv, pm], | ||
target in [p1, sp, ds, dv, pm] | ||
lres = kron(source, target) | ||
rres = kron(target, source) | ||
flres = kron(Matrix(source), Matrix(target)) | ||
frres = kron(Matrix(target), Matrix(source)) | ||
@test lres == flres | ||
@test rres == frres | ||
@test eltype(lres) == eltype(flres) | ||
@test eltype(rres) == eltype(frres) | ||
if !(target === ds && source === ds) | ||
@test !(typeof(lres) <: StridedMatrix) | ||
@test !(typeof(rres) <: StridedMatrix) | ||
for source in Any[p1, sp, ds, dv, pm], | ||
target in Any[p1, sp, ds, dv, pm] | ||
lres = kron(source, target) | ||
rres = kron(target, source) | ||
flres = kron(Matrix(source), Matrix(target)) | ||
frres = kron(Matrix(target), Matrix(source)) | ||
@test lres == flres | ||
@test rres == frres | ||
@test eltype(lres) == eltype(flres) | ||
@test eltype(rres) == eltype(frres) | ||
if !(target === ds && source === ds) | ||
@test !(typeof(lres) <: StridedMatrix) | ||
@test !(typeof(rres) <: StridedMatrix) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters