Mercurial > hg > octave-lyh
comparison liboctave/Matrix-ext.cc @ 182:2db13bf4f3e2
[project @ 1993-10-23 22:51:34 by jwe]
author | jwe |
---|---|
date | Sat, 23 Oct 1993 22:51:34 +0000 |
parents | 2cd2476fb32d |
children | 1a48a1b91489 |
comparison
equal
deleted
inserted
replaced
181:91ec95436dca | 182:2db13bf4f3e2 |
---|---|
227 | 227 |
228 return info; | 228 return info; |
229 } | 229 } |
230 | 230 |
231 /* | 231 /* |
232 * CHOL stuff | |
233 */ | |
234 | |
235 int | |
236 CHOL::init (const Matrix& a) | |
237 { | |
238 if (a.nr != a.nc) | |
239 FAIL; | |
240 | |
241 char uplo = 'U'; | |
242 | |
243 int n = a.nc; | |
244 int info; | |
245 | |
246 double *h = dup (a.data, a.len); | |
247 | |
248 F77_FCN (dpotrf) (&uplo, &n, h, &n, &info, 1L); | |
249 | |
250 chol_mat = Matrix (h, n, n); | |
251 | |
252 // If someone thinks of a more graceful way of doing this (or faster for | |
253 // that matter :-)), please let me know! | |
254 | |
255 if (n > 1) | |
256 for (int j = 0; j < a.nc; j++) | |
257 for (int i = j+1; i < a.nr; i++) | |
258 chol_mat.elem (i, j) = 0.0; | |
259 | |
260 | |
261 return info; | |
262 } | |
263 | |
264 | |
265 int | |
266 ComplexCHOL::init (const ComplexMatrix& a) | |
267 { | |
268 if (a.nr != a.nc) | |
269 FAIL; | |
270 | |
271 char uplo = 'U'; | |
272 | |
273 int n = a.nc; | |
274 int info; | |
275 | |
276 Complex *h = dup (a.data, a.len); | |
277 | |
278 F77_FCN (zpotrf) (&uplo, &n, h, &n, &info, 1L); | |
279 | |
280 chol_mat = ComplexMatrix (h, n, n); | |
281 | |
282 // If someone thinks of a more graceful way of doing this (or faster for | |
283 // that matter :-)), please let me know! | |
284 | |
285 if (n > 1) | |
286 for (int j = 0; j < a.nc; j++) | |
287 for (int i = j+1; i < a.nr; i++) | |
288 chol_mat.elem (i, j) = 0.0; | |
289 | |
290 return info; | |
291 } | |
292 | |
293 | |
294 /* | |
232 * HESS stuff | 295 * HESS stuff |
233 */ | 296 */ |
234 | 297 |
235 int | 298 int |
236 HESS::init (const Matrix& a) | 299 HESS::init (const Matrix& a) |