SparseMat_Tensorproduct

PURPOSE ^

C/C++ source

SYNOPSIS ^

C/C++ source

DESCRIPTION ^

C/C++ source

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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 /*Check B is indeed a vector ie a (n,1) Tensor*/
0010 if(B.sizedim[0]!=1){fprintf(stdout,"B is not a vector");
0011 return;}
0012 
0013 /*Check dimensions consistency*/
0014 if(B.sizedim[1]!=A.m){fprintf(stdout,"Dimension mismatch\n");
0015 /*printf("m=%i n=%i\n", A.m,A.n);
0016 printf("Bm=%iBn=%i\n",B.sizedim[0],B.sizedim[1]);*/
0017 return;}
0018 
0019 
0020 /*Create C*/
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 /*printf("C created\n");
0031 printf("Csize=%i\n",(*C).size);*/
0032 for(j=0;j<(*C).size;j++){
0033       for(p=A.jc[j];p/* printf("done SparseMat_Tensorproduct\n");*/
0038 }

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.