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
6 changes: 3 additions & 3 deletions src/julia/generic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ function Base.convert(::Type{Matrix{T}}, A::Base.VecOrMat{T}) where {T}
m, n = size(A, 1), size(A, 2)
B = Matrix(T)
resize!(B, m, n)
Base.unsafe_copy!(pointer(B), pointer(A), m*n)
Base.unsafe_copyto!(pointer(B), pointer(A), m*n)
return B
end
function Base.convert(::Type{Base.Matrix{T}}, A::Matrix{T}) where {T}
m, n = size(A)
B = Base.Matrix{T}(m, n)
Base.unsafe_copy!(pointer(B), pointer(A), m*n)
B = Base.Matrix{T}(undef, m, n)
Base.unsafe_copyto!(pointer(B), pointer(A), m*n)
return B
end

Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ using Test
function runtests_mpirun()
nprocs = min(4, Sys.CPU_THREADS)
testdir = dirname(@__FILE__)
testfiles = ["lav.jl", "lavdense.jl", "matrix.jl", "distmatrix.jl", "props.jl", "generic.jl", "spectral.jl", "tsvd.jl"]
testfiles = ["lav.jl", "lavdense.jl", "matrix.jl", "distmatrix.jl", "props.jl", "generic.jl", "spectral.jl", "tsvd.jl", "svd.jl"]
nfail = 0
@info "Running Elemental.jl tests"
for f in testfiles
Expand Down
10 changes: 10 additions & 0 deletions test/svd.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using LinearAlgebra, Elemental, Test

m, n = 100, 80
A = Elemental.Matrix(Float64)
Elemental.gaussian!(A, m, n)
U_Elemental, s_Elemental, V_Elemental = svd(A)
U_LAPACK, s_LAPACK, V_LAPACK = svd(Matrix(A))
@test abs.(Matrix(U_Elemental)'*U_LAPACK) ≈ Matrix(I, n, n)
@test Matrix(s_Elemental) ≈ s_LAPACK
@test abs.(Matrix(V_Elemental)'*V_LAPACK) ≈ Matrix(I, n, n)