-
Notifications
You must be signed in to change notification settings - Fork 99
SPARSE 2::trsv
Luc Berger edited this page Jun 6, 2020
·
3 revisions
Header File: KokkosSparse_trsv.hpp
Usage: KokkosSparse::trsv(uplo,trans,diag,A,b,x);
Solves for the left-hand side y
of the upper- or lower-triangular linear system A*x=b
template <class AMatrix, class BMV, class XMV>
void
trsv (const char uplo[],
const char trans[],
const char diag[],
const AMatrix& A,
const BMV& b,
const XMV& x);
- SolverMode: "U" (for upper triangular) or "L" (for lower triangular).
- InputMode: "N" for no transpose, "T" for transpose, or "C" for conjugate transpose.
- DiagonalMode: "U" (for implicit unit diagonal) or "N" (for not).
- InputMatrix: a
KokkosSparse::CrsMatrix
- InputVector: a rank-1 or rank-2
Kokkos::View
with non-const data type. - Input/OutputVector: a rank-1 or rank-2
Kokkos::View
with non-const data type.
- The input matrix
A
must be upper triangular or lower triangular. OutputVector::value_type == OutputVector::non_const_value_type
A.rank == 2
y.rank == b.rank
-
y.rank == 1
ory.rank == 2
y.extent(0) == b.extent(0)
y.extent(1) == b.extent(1)
#include<Kokkos_Core.hpp>
#include<KokkosSparse_trsv.hpp>
int main(int argc, char* argv[]) {
Kokkos::initialize();
int N = atoi(argv[1]);
Kokkos::View<double**> A("A",N,N);
Kokkos::View<double*> b("X",N);
Kokkos::View<double*> y("Y",N);
// Initialize A as a lower-triangular matrix
// Initialize b as a vector solution in the range-space of A
// ...
KokkosSparse::trsv("L", "N", "N", A, b, x);
KokkosSparse::trsv("N", alpha, input_mat, x, beta, y);
Kokkos::finalize();
}