comparison liboctave/CmplxCHOL.cc @ 7700:efccca5f2ad7

more QR & Cholesky updating functions
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 07 Apr 2008 11:43:19 -0400
parents 07522d7dcdf8
children 7c9ba697a479
comparison
equal deleted inserted replaced
7699:27a5f578750c 7700:efccca5f2ad7
55 F77_FUNC (zch1up, ZCH1UP) (const octave_idx_type&, Complex*, Complex*, double*); 55 F77_FUNC (zch1up, ZCH1UP) (const octave_idx_type&, Complex*, Complex*, double*);
56 56
57 F77_RET_T 57 F77_RET_T
58 F77_FUNC (zch1dn, ZCH1DN) (const octave_idx_type&, Complex*, Complex*, double*, 58 F77_FUNC (zch1dn, ZCH1DN) (const octave_idx_type&, Complex*, Complex*, double*,
59 octave_idx_type&); 59 octave_idx_type&);
60
61 F77_RET_T
62 F77_FUNC (zqrshc, ZQRSHC) (const octave_idx_type&, const octave_idx_type&, const octave_idx_type&,
63 Complex*, Complex*, const octave_idx_type&, const octave_idx_type&);
64
65 F77_RET_T
66 F77_FUNC (zchinx, ZCHINX) (const octave_idx_type&, const Complex*, Complex*, const octave_idx_type&,
67 const Complex*, octave_idx_type&);
68
69 F77_RET_T
70 F77_FUNC (zchdex, ZCHDEX) (const octave_idx_type&, const Complex*, Complex*, const octave_idx_type&);
60 } 71 }
61 72
62 octave_idx_type 73 octave_idx_type
63 ComplexCHOL::init (const ComplexMatrix& a, bool calc_cond) 74 ComplexCHOL::init (const ComplexMatrix& a, bool calc_cond)
64 { 75 {
208 (*current_liboctave_error_handler) ("CHOL downdate dimension mismatch"); 219 (*current_liboctave_error_handler) ("CHOL downdate dimension mismatch");
209 220
210 return info; 221 return info;
211 } 222 }
212 223
224 octave_idx_type
225 ComplexCHOL::insert_sym (const ComplexMatrix& u, octave_idx_type j)
226 {
227 octave_idx_type info = -1;
228
229 octave_idx_type n = chol_mat.rows ();
230
231 if (u.length () != n+1)
232 (*current_liboctave_error_handler) ("CHOL insert dimension mismatch");
233 else if (j < 0 || j > n)
234 (*current_liboctave_error_handler) ("CHOL insert index out of range");
235 else
236 {
237 ComplexMatrix chol_mat1 (n+1, n+1);
238
239 F77_XFCN (zchinx, ZCHINX, (n, chol_mat.data (), chol_mat1.fortran_vec (),
240 j+1, u.data (), info));
241
242 chol_mat = chol_mat1;
243 }
244
245 return info;
246 }
247
248 void
249 ComplexCHOL::delete_sym (octave_idx_type j)
250 {
251 octave_idx_type n = chol_mat.rows ();
252
253 if (j < 0 || j > n-1)
254 (*current_liboctave_error_handler) ("CHOL insert index out of range");
255 else
256 {
257 ComplexMatrix chol_mat1 (n-1, n-1);
258
259 F77_XFCN (zchdex, ZCHDEX, (n, chol_mat.data (), chol_mat1.fortran_vec (), j+1));
260
261 chol_mat = chol_mat1;
262 }
263 }
264
265 void
266 ComplexCHOL::shift_sym (octave_idx_type i, octave_idx_type j)
267 {
268 octave_idx_type n = chol_mat.rows ();
269 Complex dummy;
270
271 if (i < 0 || i > n-1 || j < 0 || j > n-1)
272 (*current_liboctave_error_handler) ("CHOL shift index out of range");
273 else
274 F77_XFCN (zqrshc, ZQRSHC, (0, n, n, &dummy, chol_mat.fortran_vec (), i+1, j+1));
275 }
276
213 ComplexMatrix 277 ComplexMatrix
214 chol2inv (const ComplexMatrix& r) 278 chol2inv (const ComplexMatrix& r)
215 { 279 {
216 return chol2inv_internal (r); 280 return chol2inv_internal (r);
217 } 281 }