Mercurial > hg > octave-nkf
comparison liboctave/sparse-base-chol.cc @ 10314:07ebe522dac2
untabify liboctave C++ sources
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 11 Feb 2010 12:23:32 -0500 |
parents | 4c0cdbe0acca |
children | fd0a3ac60b0e |
comparison
equal
deleted
inserted
replaced
10313:f3b65e1ae355 | 10314:07ebe522dac2 |
---|---|
58 { | 58 { |
59 p = Sp [k]; | 59 p = Sp [k]; |
60 pend = Sp [k+1]; | 60 pend = Sp [k+1]; |
61 Sp [k] = pdest; | 61 Sp [k] = pdest; |
62 for (; p < pend; p++) | 62 for (; p < pend; p++) |
63 { | 63 { |
64 sik = Sx [p]; | 64 sik = Sx [p]; |
65 if (CHOLMOD_IS_NONZERO (sik)) | 65 if (CHOLMOD_IS_NONZERO (sik)) |
66 { | 66 { |
67 if (p != pdest) | 67 if (p != pdest) |
68 { | 68 { |
69 Si [pdest] = Si [p]; | 69 Si [pdest] = Si [p]; |
70 Sx [pdest] = sik; | 70 Sx [pdest] = sik; |
71 } | 71 } |
72 pdest++; | 72 pdest++; |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
76 Sp [ncol] = pdest; | 76 Sp [ncol] = pdest; |
77 } | 77 } |
78 #endif | 78 #endif |
79 | 79 |
88 octave_idx_type a_nc = a.cols (); | 88 octave_idx_type a_nc = a.cols (); |
89 | 89 |
90 if (a_nr != a_nc) | 90 if (a_nr != a_nc) |
91 { | 91 { |
92 (*current_liboctave_error_handler) | 92 (*current_liboctave_error_handler) |
93 ("SparseCHOL requires square matrix"); | 93 ("SparseCHOL requires square matrix"); |
94 return -1; | 94 return -1; |
95 } | 95 } |
96 | 96 |
97 cholmod_common *cm = &Common; | 97 cholmod_common *cm = &Common; |
98 | 98 |
181 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | 181 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; |
182 Lsparse = CHOLMOD_NAME(factor_to_sparse) (Lfactor, cm); | 182 Lsparse = CHOLMOD_NAME(factor_to_sparse) (Lfactor, cm); |
183 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | 183 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; |
184 | 184 |
185 if (minor_p > 0 && minor_p < a_nr) | 185 if (minor_p > 0 && minor_p < a_nr) |
186 { | 186 { |
187 size_t n1 = a_nr + 1; | 187 size_t n1 = a_nr + 1; |
188 Lsparse->p = CHOLMOD_NAME(realloc) (minor_p+1, | 188 Lsparse->p = CHOLMOD_NAME(realloc) (minor_p+1, |
189 sizeof(octave_idx_type), | 189 sizeof(octave_idx_type), |
190 Lsparse->p, &n1, cm); | 190 Lsparse->p, &n1, cm); |
191 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | 191 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; |
192 CHOLMOD_NAME(reallocate_sparse) | 192 CHOLMOD_NAME(reallocate_sparse) |
193 (static_cast<octave_idx_type *>(Lsparse->p)[minor_p], Lsparse, cm); | 193 (static_cast<octave_idx_type *>(Lsparse->p)[minor_p], Lsparse, cm); |
194 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | 194 END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; |
195 Lsparse->ncol = minor_p; | 195 Lsparse->ncol = minor_p; |
196 } | 196 } |
197 | 197 |
198 drop_zeros (Lsparse); | 198 drop_zeros (Lsparse); |
199 | 199 |
200 if (! natural) | 200 if (! natural) |
201 { | 201 { |
202 perms.resize (a_nr); | 202 perms.resize (a_nr); |
203 for (octave_idx_type i = 0; i < a_nr; i++) | 203 for (octave_idx_type i = 0; i < a_nr; i++) |
204 perms(i) = static_cast<octave_idx_type *>(Lfactor->Perm)[i]; | 204 perms(i) = static_cast<octave_idx_type *>(Lfactor->Perm)[i]; |
205 } | 205 } |
206 | 206 |
207 static char tmp[] = " "; | 207 static char tmp[] = " "; |
208 | 208 |
209 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; | 209 BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; |
210 CHOLMOD_NAME(free_factor) (&Lfactor, cm); | 210 CHOLMOD_NAME(free_factor) (&Lfactor, cm); |