\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\)
det_by_minor.py¶
View page sourcePython det_by_minor: Source Code¶
import math
import cmpad
# BEGIN 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
# END PROTOTYPE
#
# option
self.option = option
#
# self.ell
ell = int( math.sqrt( option['n_arg'] ) )
if( ell * ell < option['n_arg'] ) :
ell += 1
assert ell * ell == option['n_arg']
self.ell = ell
#
# r, c
self.r = (ell + 1) * [0]
self.c = (ell + 1) * [0]
for i in range(ell) :
self.r[i] = i + 1
self.c[i] = i + 1
self.r[ell] = 0
self.c[ell] = 0
#
# call
def __call__(self, x) :
#
# d
d = cmpad.det_of_minor(x, self.ell, self.ell, self.r, self.c)
#
return [ d ]