comparison src/DLD-FUNCTIONS/chol.cc @ 8871:fb1c929dbbb7

tests vs. 64-bit indexing
author John W. Eaton <jwe@octave.org>
date Wed, 25 Feb 2009 12:56:36 -0500
parents a6edd5c23cb5
children 0d7ebf353400
comparison
equal deleted inserted replaced
8870:eea0e1b45ec0 8871:fb1c929dbbb7
193 if (LLt) 193 if (LLt)
194 retval(0) = fact.L(); 194 retval(0) = fact.L();
195 else 195 else
196 retval(0) = fact.R(); 196 retval(0) = fact.R();
197 } 197 }
198 else 198 p else
199 error ("chol: matrix not positive definite"); 199 error ("chol: matrix not positive definite");
200 } 200 }
201 } 201 }
202 else if (arg.is_complex_type ()) 202 else if (arg.is_complex_type ())
203 { 203 {
468 return retval; 468 return retval;
469 } 469 }
470 470
471 /* 471 /*
472 472
473 %!test 473 %!shared A, Ainv
474 %! A = [2,0.2;0.2,1]; 474 %! A = [2,0.2;0.2,1];
475 %! Ainv = inv(A); 475 %! Ainv = inv(A);
476 %!test
476 %! Ainv1 = cholinv(A); 477 %! Ainv1 = cholinv(A);
478 %! assert (norm(Ainv-Ainv1),0,1e-10)
479 %!testif HAVE_CHOLMOD
477 %! Ainv2 = inv(sparse(A)); 480 %! Ainv2 = inv(sparse(A));
481 %! assert (norm(Ainv-Ainv2),0,1e-10)
482 %!testif HAVE_CHOLDMOD
478 %! Ainv3 = cholinv(sparse(A)); 483 %! Ainv3 = cholinv(sparse(A));
484 %! assert (norm(Ainv-Ainv3),0,1e-10)
485 %!testif HAVE_CHOLDMOD
479 %! Ainv4 = spcholinv(sparse(A)); 486 %! Ainv4 = spcholinv(sparse(A));
480 %! assert (norm(Ainv-Ainv1),0,1e-10)
481 %! assert (norm(Ainv-Ainv2),0,1e-10)
482 %! assert (norm(Ainv-Ainv3),0,1e-10)
483 %! assert (norm(Ainv-Ainv4),0,1e-10) 487 %! assert (norm(Ainv-Ainv4),0,1e-10)
484 488
485 */ 489 */
486 490
487 DEFUN_DLD (chol2inv, args, , 491 DEFUN_DLD (chol2inv, args, ,