-  3.41.0
pyfaust.factparams.ConstraintGeneric Class Reference

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
 

Detailed Description

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.

See also
ConstraintGeneric.__init__, ConstraintInt,
ConstraintReal, ConstraintMat,
pyfaust.fact.palm4msa, pyfaust.fact.hierarchical,
ParamsPalm4MSA, ParamsHierarchical.

Constructor & Destructor Documentation

◆ __init__()

def pyfaust.factparams.ConstraintGeneric.__init__ (   self,
  name,
  num_rows,
  num_cols,
  cons_value,
  normalized = True,
  pos = False 
)

Constructs a generic constraint.

Warning
This constructor shouldn't be called directly as the class is abstract.
Parameters
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.
Exceptions
TypeErrorCan'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.

Member Function Documentation

◆ __repr__()

def pyfaust.factparams.ConstraintGeneric.__repr__ (   self)

◆ is_int_constraint()

def pyfaust.factparams.ConstraintGeneric.is_int_constraint (   self)

Returns True if this constraint is a ConstraintInt, False otherwise.

◆ is_mat_constraint()

def pyfaust.factparams.ConstraintGeneric.is_mat_constraint (   self)

Returns True if this constraint is a ConstraintMat, False otherwise.

◆ is_real_constraint()

def pyfaust.factparams.ConstraintGeneric.is_real_constraint (   self)

Returns True if this constraint is a ConstraintReal, False otherwise.

◆ project()

def pyfaust.factparams.ConstraintGeneric.project (   self,
  M 
)

Applies the constraint to the matrix M.

Note
The project function is also called a proximal operator.
Parameters
Ma numpy array, it must be of the same size as set in object attributes self._num_rows, self._num_cols.
Exceptions
ValueErrorif M.shape and self._num_rows, self._num_cols don't agree.
TypeErrorif M is not a numpy.ndarray
Returns
The proximal operator result as a numpy array.

Reimplemented in pyfaust.factparams.ConstraintReal, pyfaust.factparams.ConstraintMat, and pyfaust.factparams.ConstraintInt.

Member Data Documentation

◆ normalized

pyfaust.factparams.ConstraintGeneric.normalized

◆ pos

pyfaust.factparams.ConstraintGeneric.pos

Property Documentation

◆ name

pyfaust.factparams.ConstraintGeneric.name = property
static

Property to access the ConstraintName of the constraint.

◆ shape

pyfaust.factparams.ConstraintGeneric.shape = property
static

The documentation for this class was generated from the following file: