lines 369-413 of file: test_more/compare_c/det_by_minor.c {xrst_begin correct_det_by_minor_c app} Correctness Test of det_by_minor Routine ######################################## Syntax ****** *flag* = ``correct_det_by_minor`` () flag **** The return value has prototype ``bool`` *flag* It value is ``1`` if the test passes and ``0`` otherwise. Source Code *********** {xrst_spell_off} {xrst_code cpp} */ bool correct_det_by_minor(void) { double a[9], det, check; double eps99 = 99.0 * DBL_EPSILON; random_seed(123); uniform_01(9, a); /* compute determinant using expansion by minors */ det = det_by_minor(a, 3); /* use expansion by minors to hand code the determinant */ check = 0.; check += a[0] * ( a[4] * a[8] - a[5] * a[7] ); check -= a[1] * ( a[3] * a[8] - a[5] * a[6] ); check += a[2] * ( a[3] * a[7] - a[4] * a[6] ); if( fabs(det / check - 1.0) < eps99 ) return true; return false; } /* {xrst_code} {xrst_spell_on} {xrst_end correct_det_by_minor_c}