- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, i must use the function mkl_dcsrgemv but there are always the segmentation error. This is the code:
#include <stdio.h>
#include "mkl.h"
typedef struct {
int dimmat,nz;
int *I; int *J; double *val;
}csr;
int main() {
double *x,*y;
csr *w;
int k;
int M;
char transa='t';
M=4;
w->val=(double *) calloc(M,sizeof(double));
x=(double *) calloc(M,sizeof(double));
y=(double *) calloc(M,sizeof(double));
w->I=(int *) calloc (M+1,sizeof(int));
w->J=(int *) calloc(M,sizeof(int));
for(k=0;k<M;++k){
w->val
x
w->J
w->I
}
w->I[M+1]=M+1;
mkl_dcsrgemv(&transa,&M,w->val,w->I,w->J,x,y);
printf("\n il vettore y: \n");
for(k=0;k<M;++k){
printf(" %lf \t %g \n",w->val
}
return 0;
}
I don't see the error. Help please.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Marco,
I think you may have an error because you didn't allocate the w struct itself, but trying to use it.
csr *w; ... w->val=(double *) calloc(M,sizeof(double));
Best regards,
Maria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Marco,
any progress with this problem? Did you try to apply what Maria suggested?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could try to apply the suggestion to allocate the structure W as was proposed by Maria.
You may also try to use the latest version of mkl 2020 update 2 which available for download.

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