Double Speed: Determinant Using Lu Factorization
Keywords: double speed: determinant using lu factorization link_det_lu speed matrix factor specifications implementation

| Prev | Next |  |  |  |  |  | double_det_lu.cpp |

Double Speed: Determinant Using Lu Factorization
Specifications
See link_det_lu .
Implementation `

    # include <cppad/utility/vector.hpp>
    # include <cppad/speed/det_by_lu.hpp>
    # include <cppad/speed/uniform_01.hpp>

    // Note that CppAD uses global_memory at the main program level
    extern bool
         global_onetape, global_atomic, global_optimize;

    bool link_det_lu(
         size_t                           size     ,
         size_t                           repeat   ,
         CppAD::vector<double>           &matrix   ,
         CppAD::vector<double>           &det      )
    {
         if(global_onetape||global_atomic||global_optimize)
              return false;
         // -----------------------------------------------------
         // setup
         CppAD::det_by_lu<double>  Det(size);
         size_t n = size * size; // number of independent variables

         // ------------------------------------------------------

         while(repeat--)
         {    // get the next matrix
              CppAD::uniform_01(n, matrix);

              // computation of the determinant
              det[0] = Det(matrix);
         }
         return true;
    }

`

Input File: speed/double/det_lu.cpp