0001 #include <stdio.h>
0002 #include <stdlib.h>
0003 #include <math.h>
0004 #include "Fokker_Planck_DKE_loop.h"
0005
0006 void SparseMat_Tensorproduct(struct SparseMatrix A,struct Tensor B,struct Tensor *C)
0007 {
0008 int i,j,p;
0009
0010 if(B.sizedim[0]!=1){fprintf(stdout,"B is not a vector");
0011 return;}
0012
0013
0014 if(B.sizedim[1]!=A.m){fprintf(stdout,"Dimension mismatch\n");
0015
0016 "Bm=%iBn=%i\n"
0017 return;}
0018
0019
0020
0021 (*C).ndims=2;
0022 (*C).sizedim=malloc(2*sizeof(int));
0023 (*C).sizedim[0]=1;
0024 (*C).sizedim[1]=A.m;
0025 (*C).size=A.m;
0026 (*C).vals=malloc((*C).size*sizeof(DOUBLE));
0027 for(i=0;i<(*C).size;i++){
0028 (*C).vals[i]=0.0;
0029 }
0030
0031 "Csize=%i\n"
0032 for(j=0;j<(*C).size;j++){
0033 for(p=A.jc[j];p