-
3.39.23
|
This is the parent class for representing a factor constraint in FAuST factorization algorithms. More...
Public Member Functions | |
def | __init__ (self, name, num_rows, num_cols, cons_value, normalized=True, pos=False) |
Constructs a generic constraint. More... | |
def | is_int_constraint (self) |
Returns True if this constraint is a ConstraintInt, False otherwise. More... | |
def | is_real_constraint (self) |
Returns True if this constraint is a ConstraintReal, False otherwise. More... | |
def | is_mat_constraint (self) |
Returns True if this constraint is a ConstraintMat, False otherwise. More... | |
def | project (self, M) |
Applies the constraint to the matrix M. More... | |
def | __repr__ (self) |
Public Attributes | |
normalized | |
pos | |
Properties | |
name = property | |
Property to access the ConstraintName of the constraint. More... | |
shape = property | |
This is the parent class for representing a factor constraint in FAuST factorization algorithms.
This class shouldn't be instantiated, rather rely on sub-classes. Typically, a constraint finds its place into a ParamsFact or sub-class instance (as a container for the factorization parameters). It's also possible to set a list of constraints with the ConstraintList class.
_name: The name of the constraint applied to the factor (ConstraintName instance). _num_rows: the number of columns of the constrained matrix. _num_cols: the number of columns of the constrained matrix. _cons_value: The value of the constraint.
def pyfaust.factparams.ConstraintGeneric.__init__ | ( | self, | |
name, | |||
num_rows, | |||
num_cols, | |||
cons_value, | |||
normalized = True , |
|||
pos = False |
|||
) |
Constructs a generic constraint.
name | (ConstraintName) The name of the constraint applied to the factor. |
num_rows | (int) the number of columns of the constrained matrix. |
num_cols | (int) the number of columns of the constrained matrix. cons_value: The value of the constraint. |
TypeError | Can't instantiate abstract class ConstraintGeneric with abstract methods project. This exception is python 3 only, but this class shouldn't be instantiated in python 2.7 either. |
Reimplemented in pyfaust.factparams.ConstraintInt, pyfaust.factparams.ConstraintReal, and pyfaust.factparams.ConstraintMat.
def pyfaust.factparams.ConstraintGeneric.__repr__ | ( | self | ) |
def pyfaust.factparams.ConstraintGeneric.is_int_constraint | ( | self | ) |
Returns True if this constraint is a ConstraintInt, False otherwise.
def pyfaust.factparams.ConstraintGeneric.is_mat_constraint | ( | self | ) |
Returns True if this constraint is a ConstraintMat, False otherwise.
def pyfaust.factparams.ConstraintGeneric.is_real_constraint | ( | self | ) |
Returns True if this constraint is a ConstraintReal, False otherwise.
def pyfaust.factparams.ConstraintGeneric.project | ( | self, | |
M | |||
) |
Applies the constraint to the matrix M.
M | a numpy array, it must be of the same size as set in object attributes self._num_rows, self._num_cols. |
ValueError | if M.shape and self._num_rows, self._num_cols don't agree. |
TypeError | if M is not a numpy.ndarray |
Reimplemented in pyfaust.factparams.ConstraintReal, pyfaust.factparams.ConstraintMat, and pyfaust.factparams.ConstraintInt.
pyfaust.factparams.ConstraintGeneric.normalized |
pyfaust.factparams.ConstraintGeneric.pos |
|
static |
Property to access the ConstraintName of the constraint.
|
static |