division

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 int division(struct Tensor A,struct Tensor B,struct Tensor* C)
0007 {
0008 int i;
0009 
0010 /* fprintf(stdout,"Checking B");*/
0011  for(i=0;iif(B.vals[i]==0.0){return -1;}
0013  }
0014      
0015  if (B.ndims ==2 && B.sizedim[0]==1 && B.sizedim[1]==1)/*B is a scalar*/ {
0016    /*fprintf(stdout,"divCase1\n");*/
0017    Tensor_Create(A.ndims,A.sizedim,C);  
0018 /*(*C).ndims=A.ndims;
0019 (*C).sizedim=A.sizedim;
0020 (*C).size=A.size;
0021 (*C).vals=malloc(A.size*sizeof(DOUBLE));*/
0022    for(i=0;ireturn 0;
0026  } 
0027  
0028 /*Other cases:Checking dimensions consistency*/   
0029 
0030 else if(A.ndims !=B.ndims){return -1;}   
0031 else {/*fprintf(stdout,"divCase2\n");*/
0032     for(i=0;iif(A.sizedim[i] != B.sizedim[i]){return -1;}
0034      }
0035    /*fprintf(stdout,"divcomputeC\n");*/
0036  
0037 /*(*C).ndims=A.ndims;
0038 (*C).sizedim=A.sizedim;
0039 (*C).size=A.size;
0040 (*C).vals=malloc(A.size*sizeof(DOUBLE)); */
0041    Tensor_Create(A.ndims,A.sizedim,C);  
0042    /*fprintf(stdout,"computing C.vals\n");*/    
0043    for(i=0;i/* fprintf(stdout,"end\n");*/
0049 return 0;
0050 }

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