- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could write code to unpack and access it I suppose, but if you're asking whether there is an easyway to access it or have MKL functions act upon it (as there is in LAPACK by specifying the first element and an appropriate leading dimension parameter as the stride) then I believe the answer is no.
Todd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compared to the classical three arrays variation of CSR mentioned by you, the NIST variation with four arraysallows working with submatrices. You just need to define pointerB and pointerE arraysproperly. You don't need to form additional the values and columns arrays since all sparse representations of submatrices can use only one copy of these arrays.
Hope it helps
All the best
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Vahid,
Your submatrix can be defined as follows:
int pointerB[3]={2, 3, 5} , pointerE[3]={3,3,8};
Here is a code example where submatrix is multiplied by vector {3,4, 5) with the help of mkl_dcsrmv
int main() {
//*******************************************************************************
// Declaration and initialization of parameters for sparse representation of
// the matrix A in the compressed sparse row format:
//*******************************************************************************
#define M 5
#define NNZ 13
#define MN
double values[NNZ] = {1.0, -1.0, -3.0, -1.0, 5.0, 4.0, 6.0, 4.0, -3.0, 6.0, 7.0, 4.0, -5.0};
int columns[NNZ] = {0, 1, 3, 0, 1, 2, 3, 4, 0, 2, 3, 2, 4};
int rowIndex[M+1] = {0, 3, 5, 8, 11, 13};
double sol_vec
double rhs_vec
double alpha=1.0, beta=0.0;
int pointerB[3]={2, 3, 5} , pointerE[3]={3,3,8};
char transa;
char matdescra[6];
int i, ishift, mn=3;
transa = 'n';
matdescra[0] = 'g';
matdescra[3] = 'c';
ishift=pointerB[0];
mkl_dcsrmv(&transa, &mn, &mn, α, matdescra,&values[ishift], &columns[ishift], pointerB, pointerE, sol_vec, β, rhs_vec);
for (i = 0; i < mn; i++) {
printf("%7.1f\n", rhs_vec);
};
}
As concerns as m and k, I'd recommend to use dimensions of the submatrix.
All the best
Sergey
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page