Skip to content

Commit

Permalink
Added initialization of matrix and vector declarations.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@1965 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Nov 16, 2005
1 parent fce530c commit 6287747
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions c_runtime/matrix.h
Expand Up @@ -28,10 +28,12 @@ void hybrd_(void (*) (int*, double *, double*, int*),
#endif

#define declare_matrix(A,nrows,ncols) double *A = new double[nrows*ncols]; \
assert(A!=0);
assert(A!=0); \
for (int i=0;i<nrows*ncols;i++) A[i]=0.0;

#define declare_vector(v,nelts) double *v=new double[nelts];\
assert(v!=0);
assert(v!=0); \
for (int i=0;i<nelts;i++) v[i]=0.0;

/* Matrixes using column major order (as in Fortran) */
#define set_matrix_elt(A,r,c,n_rows,value) A[r+n_rows*c]=value
Expand Down

0 comments on commit 6287747

Please sign in to comment.