Prev Next correct_det_by_minor_c

@(@\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }@)@This is cppad-20221105 documentation. Here is a link to its current documentation .
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
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;
}

Input File: test_more/compare_c/det_by_minor.c