0001 #include <stdio.h>
0002 #include <stdlib.h>
0003 #include <math.h>
0004 #include "Fokker_Planck_DKE_loop.h"
0005 int Tensor_Sum(struct Tensor A,struct Tensor B,DOUBLE m,struct Tensor *C)
0006 {
0007
0008
0009 int i;
0010 if(A.ndims!=B.ndims){printf("dimension mismatch 1");return -1;}
0011 else {
0012 for(i=1;iif(A.sizedim[i]!=B.sizedim[i]){printf("dimension mismatch 2");return -1;}
0014 }
0015
0016
0017
0018
0019 Tensor_Create(A.ndims,A.sizedim,C);
0020 for(i=0;i<(*C).size;i++){
0021 (*C).vals[i]=A.vals[i]+m*B.vals[i];
0022 }
0023 }
0024 }
0025