-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5e5798
commit 1894f7b
Showing
5 changed files
with
161 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
function LinearAlgebra.lu(A::CuSparseMatrixCSR{T,Cint}) where T <: BlasFloat | ||
n = LinearAlgebra.checksquare(A) | ||
solver = CudssSolver(A, 'G', 'F') | ||
x = CudssMatrix(T, n) | ||
b = CudssMatrix(T, n) | ||
cudss("analysis", solver, x, b) | ||
cudss("factorization", solver, x, b) | ||
return solver | ||
end | ||
|
||
function LinearAlgebra.ldlt(A::CuSparseMatrixCSR{T,Cint}) where T <: BlasFloat | ||
n = LinearAlgebra.checksquare(A) | ||
structure = T <: Real ? 'S' : 'H' | ||
solver = CudssSolver(A, structure, 'F') | ||
x = CudssMatrix(T, n) | ||
b = CudssMatrix(T, n) | ||
cudss("analysis", solver, x, b) | ||
cudss("factorization", solver, x, b) | ||
return solver | ||
end | ||
|
||
function LinearAlgebra.cholesky(A::CuSparseMatrixCSR{T,Cint}) where T <: BlasFloat | ||
n = LinearAlgebra.checksquare(A) | ||
structure = T <: Real ? "SDP" : "HDP" | ||
solver = CudssSolver(A, structure, 'F') | ||
x = CudssMatrix(T, n) | ||
b = CudssMatrix(T, n) | ||
cudss("analysis", solver, x, b) | ||
cudss("factorization", solver, x, b) | ||
return solver | ||
end | ||
|
||
for fun in (:lu!, :ldlt!, :cholesky!) | ||
@eval begin | ||
function LinearAlgebra.$fun(solver::CudssSolver, A::CuSparseMatrixCSR{T,Cint}) where T <: BlasFloat | ||
n = LinearAlgebra.checksquare(A) | ||
cudss_set(solver.matrix, A) | ||
x = CudssMatrix(T, n) | ||
b = CudssMatrix(T, n) | ||
cudss("factorization", solver, x, b) | ||
return solver | ||
end | ||
end | ||
end | ||
|
||
for type in (:CuVector, :CuMatrix) | ||
@eval begin | ||
function LinearAlgebra.ldiv!(solver::CudssSolver, b::$type{T}) where T <: BlasFloat | ||
cudss("factorization", solver, b, b) | ||
end | ||
|
||
function LinearAlgebra.ldiv!(x::$type{T}, solver::CudssSolver, b::$type{T}) where T <: BlasFloat | ||
cudss("factorization", solver, x, b) | ||
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
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