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

I have got some basic questions.

I'm trying to use the functions of Intel Math Kernel Library- for converting a matrix in dense representation into CSR format.

There are the following possibilities as I see:

1) The function

**mkl_sdnscsr**which has the following arguments;

(job, m , n, adns, lda, acsr, ja, ia, info)

Now:

from the inputs required;

**acsr = array containing non zero elements of the matrix A. Its length is equal to the number of non zero elements of the matrix A.**

ja = array containing the column indices for each non zero element of the matrix A.

My question is;

ja = array containing the column indices for each non zero element of the matrix A.

if in my routine, I do not have theindices of the non zero elements of my matrix available, then , how do I use this function?

Because, I have a matrix (Say) 'K' which is in dense form,and I have not stored the indices of the non zero elements. How can I use this function in such a case?

I just havea matrix of form:

3.14 0 0 20.04 0 0

0 27 0 0 -0.6 0

0 0 -0.01 0 0 0

-0.031 0 0 0.08 0 314

That is all and I want to convert into CSR format.

I just want to give this matrix as input and get the CSR format. Is it possible?

Pleasehelp.

Link Copied

- 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

Thanks a lot for your reply.

My code is like this:

int job[50],m,n;

float adns[3][3];

int lda;

job[1]=0; job[2]=1; job[3]=1; job[4]=2;job[5]= 100;job[6]=1;

m=3;n=3;

adns[1][1]=1; adns[1][2]=0;adns[1][3]=0; adns[2][1]=0; adns[2][2]=3;adns[2][3]=4; adns[3][1]=0;adns[3][2]=4;adns[3][3]=5;

lda=3;

mkl_sdnscsr(job,&m,&n,adns,&lda)

return 0;

I get an error identifier

*mkl_sdnscsr is not identified*. Please can anyone help? What is this due to?

- 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

#include "mkl_spblas.h"

in your source file(s) and link against the appropriate MKL libraries.

Your MKL installation comes with at least one example source file (....\mkl\examples\spblas\source or ...\mkl\examples\spblasc\source\sconverters.c -- depending on the version of MKL that you have) that illustrates how to convert between different matrix storage formats.

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

// project9.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include "mkl_spblas.h"

#include "mkl_types.h"

int _tmain(int argc, _TCHAR* argv[])

{

/********************************************************************************

* 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 m = M, n=N, lda=LDA, nzmax=NZMAX, nnz = NNZ, mblk=MBLK, nn=NN, info=INFO,mn=MN;

MKL_INT ibase1 = IBASE1,ibase2 = IBASE2, locat = LOCAT,idiag = IDIAG,ndiag = NDIAG;

float Adns[MN];

float Adns_standard[MN];

float Absr[NZMAX];

float Absr_standard[NZMAX] = {5.0, 9.0, 8.0, 2.0, 3.0, 1.0, 6.0, 4.0};

float Acsr[NZMAX];

float Acsr_standard[NZMAX] = {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};

float Acsc[NZMAX];

float Acsc_standard[NZMAX] = {5.0, 9.0, 8.0, 2.0, 3.0,

1.0, 6.0, 4.0};

float Adia[INDIA];

float Adia_standard[INDIA] = {0.0, 9.0, 0.0, 1.0,

5.0, 2.0, 3.0, 4.0,

8.0, 0.0, 6.0, 0.0};

float Asky[6];

float Askyl_standard[6] = {5.0, 9.0, 2.0, 3.0, 1.0, 4.0};

float Acoo[NZMAX];

float Acoo_standard[NZMAX] = {5.0, 8.0, 9.0, 2.0, 3.0, 6.0, 1.0, 4.0};

MKL_INT AI[M+1];

MKL_INT AI1[M+1];

MKL_INT AI_standard[M+1] = {1, 3, 5, 7, 9};

MKL_INT AJ[NZMAX];

MKL_INT AJ1[NZMAX];

MKL_INT AJ_standard[NZMAX] = {1, 2, 1, 2, 3, 4, 3, 4};

MKL_INT AJB[NN];

MKL_INT AJB_standard[MBLK] = {1,2};

MKL_INT AIB[NN+1];

MKL_INT AIB_standard[MBLK+1] = {1, 2, 3};

MKL_INT ir[NZMAX];

MKL_INT ir_standard[NZMAX] = {1, 1, 2, 2, 3, 3, 4, 4};

MKL_INT jc[NZMAX];

MKL_INT jc_standard[NZMAX] = {1, 2, 1, 2, 3, 4, 3, 4};

MKL_INT pointers[M+1];

MKL_INT pointersl_standard[M+1] = {1, 2, 4, 5, 7};

MKL_INT distance[IDIAG];

MKL_INT distance_standard[IDIAG] = {-1, 0, 1};

MKL_INT AJL[6];

MKL_INT AJL_standard[6] = {1, 1, 2, 3, 3, 4};

//*************************************************************************************************

//* Declaration of local variables :

//*************************************************************************************************

MKL_INT job0=1;

MKL_INT ifail=1;

MKL_INT nr,ldAbsr;

MKL_INT i,j,ij;

float rfail=0.0;

MKL_INT job[8];

printf("\n EXAMPLE PROGRAM FOR CONVERTER FROM ONE\n");

printf("\n SPARSE FORMAT ROUTINES TO OTHER \n");

printf("\n REAL SINGLE PRECISION \n");

locat=2;

ibase1=1;

ibase2=1;

job[1]=ibase1;

job[2]=ibase2;

job[3]=locat;

job[4]=nzmax;

//***************************************************************************************************

//* TASK 1 Obtain compressed sparse row matrix from dense matrix

//**************************************************************************************************

for ( j=0; j

for ( i=0; i

Adns[i + lda*j]=0.0;

Adns[0]=5.0;

Adns[1]=9.0;

Adns[4]=8.0;

Adns[5]=2.0;

Adns[10]=3.0;

Adns[11]=1.0;

Adns[14]=6.0;

Adns[15]=4.0;

for ( j=0; j

for ( i=0; i

Adns_standard[i + lda*j]=Adns[i + lda*j];

job[0]=0;

job[5]=1;

mkl_sdnscsr(job,&m,&n,Adns,&lda,Acsr,AJ,AI,&info);

if (info!=0) goto FAILURE1;

for ( i=0; i

{

ifail=AI*-AI_standard ;*

if (ifail!=0) goto FAILURE1;

}

for ( i=0; i

{

ifail=AJ*-AJ_standard ;*

if (ifail!=0) goto FAILURE1;

}

for ( i=0; i

{

rfail=Acsr*-Acsr_standard ;*

if (rfail!=0) goto FAILURE1;

}

FAILURE1: printf("\n Example FAILED to convert from dns to csr...\n");

return 1;

}

When I build, i get error:**1>project9.obj : error LNK2019: unresolved external symbol _mkl_sdnscsr referenced in function _wmain**Please help, urgent.

- 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

- 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

[bash]..mkllibia32> dumpbin /symbols mkl_core.lib | find "mkl_sdnscsr"If nothing is found, you conclude that only the double precision version is available, and you may consider obtaining a later version of MKL.

[/bash]

Your code in #5 above has a bug; you need to add a "return 0;" statement before the FAILURE1: label. Otherwise, the code prints a "FAILED" message even after a correct run.

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