23 int getMax (
const int n,
const double * __restrict__ Arr) {
29 double maxVal = fabs(Arr[
INDEX(0)]);
30 for (
int i = 1; i < n; ++i) {
31 if (fabs(Arr[
INDEX(i)]) > maxVal) {
33 maxVal = fabs(Arr[
INDEX(i)]);
50 void scale (
const int n,
const double val,
double* __restrict__ arrX) {
52 for (
int i = 0; i < n; ++i) {
53 arrX[
INDEX(i)] *= val;
70 void swap (
const int n,
double* __restrict__ arrX,
const int incX,
double* __restrict__ arrY,
const int incY) {
75 for (
int i = 0; i < n; ++i) {
76 double temp = arrX[
INDEX(ix)];
78 arrY[
INDEX(iy)] = temp;
109 void GERU (
const int n,
const double alpha,
const double* __restrict__ arrX,
110 const double* __restrict__ arrY,
const int incY,
double* __restrict__ A,
const int lda) {
112 for (
int j = 0; j < n; ++j) {
113 if (fabs(arrY[
INDEX(j * incY)]) > 0.0) {
115 double temp = alpha * arrY[
INDEX(j * incY)];
117 for (
int i = 0; i < n; ++i) {
118 A[
INDEX(i + (lda * j))] += arrX[
INDEX(i)] * temp;
145 void getLU (
const int n,
double* __restrict__ A,
int* __restrict__ indPivot,
int* __restrict__ info) {
147 for (
int j = 0; j < n; ++j) {
152 indPivot[
INDEX(j)] = jp;
165 }
else if (*info == 0) {
#define GRID_DIM
The total number of threads in the Grid, provides an offset between vector entries.
#define STRIDE
the matrix dimensions
__device__ void swap(const int n, double *__restrict__ arrX, const int incX, double *__restrict__ arrY, const int incY)
interchanges two vectors arrX and arrY.
__device__ void GERU(const int n, const double alpha, const double *__restrict__ arrX, const double *__restrict__ arrY, const int incY, double *__restrict__ A, const int lda)
GERU performs the rank 1 operation where alpha is a scalar, arrX and arrY are n element vectors...
simple convenience file to include the correct solver properties file
__device__ int getMax(const int n, const double *__restrict__ Arr)
getMax finds the index of the first element having maximum absolute value.
__device__ void getLU(const int n, double *__restrict__ A, int *__restrict__ indPivot, int *__restrict__ info)
Computes the LU factorization of a (n x n) matrix using partial pivoting with row interchanges...
#define INDEX(i)
Convenience macro to get the value of a vector at index i, calculated as i * GRID_DIM + T_ID...
__device__ void scale(const int n, const double val, double *__restrict__ arrX)
scale multiplies a vector (with increment equal to one) by a constant val.