Tensor_Sum

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 int Tensor_Sum(struct Tensor A,struct Tensor B,DOUBLE m,struct Tensor *C)
0006 {
0007 /*Does A+m*B*/
0008 /* printf("Begon Tensor-Sum");*/
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   /*(*C).ndims=A.ndims;
0016   (*C).sizedim=A.sizedim;
0017   (*C).size=A.size;
0018   (*C).vals=malloc(sizeof(DOUBLE)*(A.size));*/
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

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