0001 #include <stdio.h>
0002 #include <stdlib.h>
0003 #include <math.h>
0004 #include "Fokker_Planck_DKE_loop.h"
0005
0006 int product(struct Tensor A,struct Tensor B,struct Tensor* C){
0007 int i;
0008
0009 if (A.ndims ==2 && A.sizedim[0]==1 && A.sizedim[1]==1)
0010 {
0011 Tensor_Create(B.ndims,B.sizedim,C);
0012 for(i=0;ireturn 0;}
0016 else if (B.ndims ==2 && B.sizedim[0]==1 && B.sizedim[1]==1)
0017
0018 Tensor_Create(A.ndims,A.sizedim,C);
0019 for(i=0;ireturn 0;
0023 }
0024
0025 else if(A.ndims !=B.ndims){return -1;fprintf(stdout,"Case1\n");}
0026 else {
0027 for(i=0;iif(A.sizedim[i] != B.sizedim[i] && ((A.ndims !=2 && A.sizedim[0]!=1 && A.sizedim[1]!=1) ||
0029 (B.ndims !=2 && B.sizedim[0]!=1 &&
0030 B.sizedim[1]!=1))){
0031 return -1;}
0032 }
0033 Tensor_Create(A.ndims,A.sizedim,C);
0034
0035 for(i=0;i