Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® oneAPI Math Kernel Library
- access to sub-matrices in CSR format

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Vahid_Jalili

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-12-2011
05:56 AM

215 Views

access to sub-matrices in CSR format

Hello all,

For example:

| 1 -1 0 -3 0 |

| -1 5 0 0 0 |

Y = | 0 0 4 6 4 |

| -3 0 6 7 0 |

| 0 0 4 0 -5 |

values[13] = {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};

columns[13] = {0, 1, 3, 0, 1, 2, 3, 4, 0, 2, 3, 2, 4};

rowIndex[6] = {0, 3, 5, 8, 11, 13};

Can I have access to sub-matrices of Y , e.g. [-3 0 // 0 0 // 6 4] or [0 0 4 // -3 0 6// 0 0 4] ?

Thanks for your help,

Link Copied

4 Replies

Todd_R_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-12-2011
10:06 PM

215 Views

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

Sergey_K_Intel1

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-13-2011
03:51 AM

215 Views

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

Hope it helps

All the best

Sergey

Vahid_Jalili

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-13-2011
06:50 AM

215 Views

Hello Sergey,

Thanks for your reply,

I am aware of pointerB and poiterE vectors used for CSR format:

For matrix Y they are as following:

pointerB* = {0, 3, 5, 8, 11};*

pointerE* = {3, 5, 8, 11, 13};*

I want to use these submatix in**mkl_scsrmv**

mkl_ccsrmv(&transa, &m, &k, α, matdescra, values, columns, pointerB, pointerE, sol_vec, β, rhs_vec);

If m and k should be dimensions of the original matrix (i.e. 5x5) or they should be dimensions of the submatrix (e.g 3x3)?

Thanks for your help.

--Vahid

Sergey_K_Intel1

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

04-14-2011
12:33 AM

215 Views

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 bestSergey*

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.