- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all:
It's driving me crazy even after reading the examples and docs
here's the code:
#include
#include "mkl_spblas.h"
#include "mkl_types.h"
int main()
{
//*******************************************************************************
// Definition arrays for sparse matrix formats
//*******************************************************************************
#define M 4
#define N 4
#define LDA 4
#define NZMAX 8
#define NNZ 8
#define MBLK 2
#define NN 2
#define INFO 0
#define MN 16
#define IBASE1 1
#define IBASE2 1
#define LOCAT 2
#define IDIAG 3
#define NDIAG 4
#define INDIA 12
MKL_INT n=N, nzmax=NZMAX, nnz = NNZ, info=INFO;
MKL_INT ibase1 = IBASE1,ibase2 = IBASE2, locat = LOCAT;
double Acsr[NZMAX];
double Acoo[NZMAX]= {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};
MKL_INT AI[M+1];
MKL_INT AJ[NZMAX] = {1, 2, 1, 2, 3, 4, 3, 4};
MKL_INT ir[NZMAX];
MKL_INT jc[NZMAX];
MKL_INT job[8];
locat=2;
ibase1=1;
ibase2=1;
job[1]=ibase1;
job[2]=ibase2;
job[3]=locat;
job[4]=nzmax;
job[0]=1;
job[5]=1;
mkl_dcsrcoo (job,&n, Acsr, AJ,AI,&nnz,Acoo, ir,jc,&info);
for(int i = 0; i< M+1;i++ )
{
printf("AI %d = %d\n",i,AI);
}
for(int i = 0; i< 8;i++ )
{
printf("Job %d = %d\n",i,job);
}
}
It's driving me crazy even after reading the examples and docs
here's the code:
#include
#include "mkl_spblas.h"
#include "mkl_types.h"
int main()
{
//*******************************************************************************
// Definition arrays for sparse matrix formats
//*******************************************************************************
#define M 4
#define N 4
#define LDA 4
#define NZMAX 8
#define NNZ 8
#define MBLK 2
#define NN 2
#define INFO 0
#define MN 16
#define IBASE1 1
#define IBASE2 1
#define LOCAT 2
#define IDIAG 3
#define NDIAG 4
#define INDIA 12
MKL_INT n=N, nzmax=NZMAX, nnz = NNZ, info=INFO;
MKL_INT ibase1 = IBASE1,ibase2 = IBASE2, locat = LOCAT;
double Acsr[NZMAX];
double Acoo[NZMAX]= {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};
MKL_INT AI[M+1];
MKL_INT AJ[NZMAX] = {1, 2, 1, 2, 3, 4, 3, 4};
MKL_INT ir[NZMAX];
MKL_INT jc[NZMAX];
MKL_INT job[8];
locat=2;
ibase1=1;
ibase2=1;
job[1]=ibase1;
job[2]=ibase2;
job[3]=locat;
job[4]=nzmax;
job[0]=1;
job[5]=1;
mkl_dcsrcoo (job,&n, Acsr, AJ,AI,&nnz,Acoo, ir,jc,&info);
for(int i = 0; i< M+1;i++ )
{
printf("AI %d = %d\n",i,AI);
}
for(int i = 0; i< 8;i++ )
{
printf("Job %d = %d\n",i,job);
}
}
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
it's not clear - what is the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Gennady Fedorov (Intel)
it's not clear - what is the problem?
let me repeat
I have a matrix A in coo one-base format. and i would like to convert it to csr one-based "3 array-variation" by using mkl_dcsrcoo
here is the code, could you please point out where the problem is ? since i dont get any result
int nb_values_A = 13;
int nb_lines_A = 5;
int nb_columns_A = 5;
double *values_coo_A;
values_coo_A = new double[nb_values_A];
MKL_INT *columns_coo_A;
columns_coo_A = new MKL_INT[nb_values_A];
MKL_INT *rows_coo_A;
rows_coo_A = new MKL_INT[nb_values_A];
values_coo_A[0] = 1.0;
values_coo_A[1] = -1.0;
values_coo_A[2] = -3.0;
values_coo_A[3] = -2.0;
values_coo_A[4] = 5.0;
values_coo_A[5] = 4.0;
values_coo_A[6] = 6.0;
values_coo_A[7] = 4.0;
values_coo_A[8] = -4.0;
values_coo_A[9] = 2.0;
values_coo_A[10] = 7.0;
values_coo_A[11] = 8.0;
values_coo_A[12] = -5.0;
columns_coo_A[0] = 1;
columns_coo_A[1] = 2;
columns_coo_A[2] = 4;
columns_coo_A[3] = 1;
columns_coo_A[4] = 2;
columns_coo_A[5] = 3;
columns_coo_A[6] = 4;
columns_coo_A[7] = 5;
columns_coo_A[8] = 1;
columns_coo_A[9] = 3;
columns_coo_A[10] = 4;
columns_coo_A[11] = 2;
columns_coo_A[12] = 5;
rows_coo_A[0] = 1;
rows_coo_A[1] = 1;
rows_coo_A[2] = 1;
rows_coo_A[3] = 2;
rows_coo_A[4] = 2;
rows_coo_A[5] = 3;
rows_coo_A[6] = 3;
rows_coo_A[7] = 3;
rows_coo_A[8] = 4;
rows_coo_A[9] = 4;
rows_coo_A[10] = 4;
rows_coo_A[11] = 5;
rows_coo_A[12] = 5;
MKL_INT job[8];
job[0] = 1; // the matrix in the coordinate format is converted to the CSR format.
job[1] = 1; // one-based indexing for the matrix in CSR format is used.
job[2] = 1; // one-based indexing for the matrix in coordinate format is used.
job[5] = 1; // only array ia is filled in for the output storage.
double *values_csr_A;
MKL_INT *columns_csr_A;
MKL_INT *rowIndex_csr_A;
rowIndex_csr_A = new MKL_INT[nb_lines_A+1];
MKL_INT nnz_coo;
MKL_INT info_coo;
// Convert COO format to CSR format
mkl_dcsrcoo (job,&nb_columns_A, values_csr_A,columns_csr_A,rowIndex_csr_A,&nnz_coo,values_coo_A,rows_coo_A,columns_coo_A,&info_coo);
int nb_values_csr_A = rowIndex_csr_A[nb_lines_A] -1;
values_csr_A = new double[nb_values_csr_A];
columns_csr_A = new MKL_INT[nb_values_csr_A];
job[5]=2;// only array ia is filled in for the output storage.
mkl_dcsrcoo (job,&nb_columns_A, values_csr_A,columns_csr_A,rowIndex_csr_A,&nnz_coo,values_coo_A,rows_coo_A,columns_coo_A,&info_coo);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
especially where in the documents can we find about the size of job? in the example i find it is of size 8
and where in the documents ca we find about job(4), job(7), job(8)?
and also dimention of the matrix A "m" . what is it ?
and where in the documents ca we find about job(4), job(7), job(8)?
and also dimention of the matrix A "m" . what is it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - liunsteingmail.com
especially where in the documents can we find about the size of job? in the example i find it is of size 8
and where in the documents ca we find about job(4), job(7), job(8)?
and also dimention of the matrix A "m" . what is it ?
and where in the documents ca we find about job(4), job(7), job(8)?
and also dimention of the matrix A "m" . what is it ?
sorry about the fuss i made
#include
#include "mkl_spblas.h"
#include "mkl_types.h"
#define NZMAX 8
#define INFO 0
#define NNZ 8
#define N 4
#define M 4
double Acoo[NZMAX] = {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};
MKL_INT AJ[NZMAX] ;
MKL_INT AI[M+1];
MKL_INT ir[NZMAX] = {1, 1, 2, 2, 3, 3, 4, 4};;
MKL_INT jc[NZMAX] = {1, 2, 1, 2, 3, 4, 3, 4};
//double Acsr[NZMAX] = {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};
double Acsr[NZMAX] ;
MKL_INT n=N, info=INFO, nnz = NNZ;
int main()
{
MKL_INT job[8];
job[1] = 1;
job[2] = 1;
//job[3] = 1; // why ?
job[4] = NZMAX;
job[0]=1;
job[5]=1;
mkl_dcsrcoo (job,&n, Acsr, AJ,AI,&nnz,Acoo, ir,jc,&info);
for(int i=0; i< 8; i++)
{
printf("AI%d = %dn",i,AI);
}
}
Reply
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