Skip to content

Commit c2d0c5f

Browse files
author
kjetil
committed
mixed: more documentation
1 parent 48b14fb commit c2d0c5f

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

opm/simulators/linalg/mixed/bslv.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,16 @@ void bslv_init(bslv_memory *mem, double tol, int max_iter, bsr_matrix const *A,
7272
prec_init(mem->P, A); // initialize structure of L,D,U components of P
7373
}
7474

75+
/**
76+
* @brief Inner product of two vectors.
77+
*
78+
* @note Function assumes vectors buffered to be an
79+
* integer multiple of cacheline size (64 bytes)
80+
*
81+
* @param a First input vector.
82+
* @param b Second input vector.
83+
* @param n Vector length.
84+
*/
7585
double __attribute__((noinline)) vec_inner2(const double *a, const double *b, int n)
7686
{
7787
const double *x = __builtin_assume_aligned(a,64);
@@ -84,13 +94,11 @@ double __attribute__((noinline)) vec_inner2(const double *a, const double *b, in
8494
{
8595
for(int j=0;j<N;j++) agg[j]+=x[i+j]*y[i+j];
8696
}
87-
//for(int j=0;j<8;j++) agg[j]+=agg[j+8];
8897
for(int j=0;j<4;j++) agg[j]+=agg[j+4];
8998
for(int j=0;j<2;j++) agg[j]+=agg[j+2];
9099
for(int j=0;j<1;j++) agg[j]+=agg[j+1];
91100

92101
return agg[0];
93-
94102
}
95103

96104
int bslv_pbicgstab3m(bslv_memory *mem, bsr_matrix *A, const double *b, double *x)

opm/simulators/linalg/mixed/prec.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void mat3_matfms(double *C, const double *A, const double *B)
175175
}
176176

177177
/**
178-
* @brief Matrix invese for 3x3 matrix.
178+
* @brief Matrix inverse for 3x3 matrix.
179179
*
180180
* @param invA Pointer to inverse matrix.
181181
* @param A Pointer to input matrix.
@@ -467,7 +467,12 @@ void prec_ilu0_factorize(prec_t *P, bsr_matrix *A)
467467
}
468468
}
469469

470-
470+
/**
471+
* @brief In-place matrix-vector multiplication for 3x3 matrices.
472+
*
473+
* @param A Pointer to input matrix.
474+
* @param x Pointer to input/output vector.
475+
*/
471476
static inline void mat3_vecmul(const double *A, double *x)
472477
{
473478
const int b=3;
@@ -483,6 +488,13 @@ static inline void mat3_vecmul(const double *A, double *x)
483488
for(int k=0;k<3;k++) x[k]=z[k];
484489
}
485490

491+
/**
492+
* @brief In-place fused matrix-vector multiply-subtract for 3x3 matrices.
493+
*
494+
* @param y Pointer to input/output vector.
495+
* @param A Pointer to input matrix.
496+
* @param x Pointer to input vector.
497+
*/
486498

487499
static inline void mat3_vecfms(double *y, const double *A, const double *x)
488500
{

0 commit comments

Comments
 (0)