Changeset 17343
- Timestamp:
- 02/22/14 13:04:26 (11 years ago)
- Location:
- issm/trunk-jpl/src/c/toolkits/gsl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp
r17328 r17343 44 44 /*allocate output pointers: */ 45 45 *px=x; 46 }47 /*}}}*/48 void DenseGslTripleSolve(IssmPDouble** pX1,IssmPDouble** pX2,IssmPDouble** pX3,IssmPDouble* A,IssmPDouble* B1,IssmPDouble* B2,IssmPDouble* B3,int n){/*{{{*/49 50 /*Allocate output: */51 IssmPDouble *X1 = xNew<IssmPDouble>(n);52 IssmPDouble *X2 = xNew<IssmPDouble>(n);53 IssmPDouble *X3 = xNew<IssmPDouble>(n);54 55 #ifdef _HAVE_GSL_56 /*GSL Matrices and vectors: */57 int s;58 59 double* Acopy = xNew<double>(n*n);60 xMemCpy(Acopy,A,n*n);61 62 /*Initialize gsl matrices and vectors: */63 gsl_matrix_view a = gsl_matrix_view_array(Acopy,n,n);64 gsl_vector_view b1= gsl_vector_view_array(B1,n);65 gsl_vector_view b2= gsl_vector_view_array(B2,n);66 gsl_vector_view b3= gsl_vector_view_array(B3,n);67 gsl_vector_view x1= gsl_vector_view_array(X1,n);68 gsl_vector_view x2= gsl_vector_view_array(X2,n);69 gsl_vector_view x3= gsl_vector_view_array(X3,n);70 71 /*Run LU and solve: */72 gsl_permutation* p = gsl_permutation_alloc (n);73 gsl_linalg_LU_decomp(&a.matrix,p,&s);74 75 gsl_linalg_LU_solve(&a.matrix,p,&b1.vector,&x1.vector);76 gsl_linalg_LU_solve(&a.matrix,p,&b2.vector,&x2.vector);77 gsl_linalg_LU_solve(&a.matrix,p,&b3.vector,&x3.vector);78 79 /*Clean up and assign output pointer*/80 xDelete(Acopy);81 gsl_permutation_free(p);82 #endif83 84 /*allocate output pointers: */85 *pX1=X1;86 *pX2=X2;87 *pX3=X3;88 46 } 89 47 /*}}}*/ -
issm/trunk-jpl/src/c/toolkits/gsl/gslincludes.h
r17328 r17343 22 22 void DenseGslSolve(IssmPDouble** pX,IssmPDouble* A,IssmPDouble* B, int n); 23 23 void DenseGslSolve(IssmDouble** pX,IssmDouble* Kff,int Kff_M,int Kff_N,IssmDouble* pf,int pf_M,Parameters* parameters); 24 void DenseGslTripleSolve(IssmPDouble** pX1,IssmPDouble** pX2,IssmPDouble** pX3,IssmPDouble* A,IssmPDouble* B1,IssmPDouble* B2,IssmPDouble* B3,int n);25 24 26 25 void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n);
Note:
See TracChangeset
for help on using the changeset viewer.