Changeset 17328
- Timestamp:
- 02/20/14 20:14:39 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/kriging/Observations.cpp
r17327 r17328 401 401 /*Solve the three linear systems*/ 402 402 #if _HAVE_GSL_ 403 DenseGslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0 404 DenseGslSolve(&Ginv1, Gamma,ones,n_obs); // Gamma^-1 ones 405 DenseGslSolve(&GinvZ, Gamma,obs,n_obs); // Gamma^-1 Z 403 DenseGslTripleSolve(&GinvG0,&Ginv1,&GinvZ,Gamma,Gamma,ones,obs,n_obs); 404 //DenseGslSolve(&GinvG0,Gamma,gamma0,n_obs); // Gamma^-1 gamma0 405 //DenseGslSolve(&Ginv1, Gamma,ones,n_obs); // Gamma^-1 ones 406 //DenseGslSolve(&GinvZ, Gamma,obs,n_obs); // Gamma^-1 Z 406 407 #else 407 408 _error_("GSL is required"); -
issm/trunk-jpl/src/c/toolkits/gsl/DenseGslSolve.cpp
r15070 r17328 32 32 } 33 33 /*}}}*/ 34 void DenseGslSolve( /*output*/ IssmPDouble** px,/*stiffness matrix:*/ IssmPDouble* Kff, int Kff_M, int Kff_N, /*right hand side load vector: */ IssmPDouble* pf, int pf_M,Parameters* parameters){ /*{{{*/34 void DenseGslSolve(IssmPDouble** px,IssmPDouble* Kff,int Kff_M,int Kff_N,IssmPDouble* pf,int pf_M,Parameters* parameters){ /*{{{*/ 35 35 36 36 /*Intermediary: */ … … 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 #endif 83 84 /*allocate output pointers: */ 85 *pX1=X1; 86 *pX2=X2; 87 *pX3=X3; 46 88 } 47 89 /*}}}*/ -
issm/trunk-jpl/src/c/toolkits/gsl/gslincludes.h
r14915 r17328 21 21 22 22 void DenseGslSolve(IssmPDouble** pX,IssmPDouble* A,IssmPDouble* B, int n); 23 void DenseGslSolve(IssmDouble** px, IssmDouble* Kff,int Kff_M, int Kff_N, IssmDouble* pf, int pf_M, Parameters* parameters); 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); 24 25 25 26 void SolverxSeq(IssmPDouble *X, IssmPDouble *A, IssmPDouble *B,int n);
Note:
See TracChangeset
for help on using the changeset viewer.