py_det_by_minor

View page source

Python Determinant Using Expansion by Minors

Syntax

      det = cmpad.det_by_minor()
      det . setup ( option )
      y = det ( x )

Prototype

class det_by_minor :
   #
   def option(self) :
      return self.option
   #
   def domain(self) :
      return self.option['n_arg']
   #
   def range(self) :
      return 1
   #
   def setup(self, option) :
      assert type(option) == dict
      assert type( option['n_arg'] ) == int
      assert type( option['n_other'] ) == int
      assert option['n_arg'] > 0
      assert option['n_other'] == 0

Algorithm

This is a Python implementation of the det_by_minor Algorithm .

Scalar

We use Scalar for the type of the elements of x and y.

det

The py_fun_obj det computes the determinant of a square matrix.

ell

see ell .

n_arg

see n_arg .

n_other

see n_other .

x

The argument x has size n_arg = \(\ell * \ell\) . The elements of the matrix \(A(x)\) is defined as follows: for \(i = 0 , \ldots , \ell-1\) and \(j = 0 , \ldots , \ell-1\), by

\[A(x)_{i,j} = x[ i * \ell + j]\]

y

The return value y has length one and its element is equal to the determinant of \(A(x)\).

Example

The file xam_det_by_minor.py contains an example and test of det_by_minor .

Source Code

det_by_minor.py displays the source code for this algorithm.