-  3.39.21
Public Member Functions | Public Attributes | List of all members
pyfaust.proj.normlin Class Reference

Functor for the NORMLIN projector. More...

Public Member Functions

def __init__ (self, shape, s=1)
 
- Public Member Functions inherited from pyfaust.proj.proj_gen
def __init__ (self, shape)
 
def __call__ (self, M)
 

Public Attributes

 constraint
 
- Public Attributes inherited from pyfaust.proj.proj_gen
 shape
 

Detailed Description

Functor for the NORMLIN projector.

A, the image matrix, is defined by \(\forall i \in \{0,...,shape[0]-1\}\) the i-th row \(A_{i,*}\) is such that \(\| A_{i,*} \|_2 = s\).

Examples

>>> from pyfaust.proj import normlin
>>> from numpy.random import rand, seed
>>> from numpy.linalg import norm
>>> import numpy as np
>>> seed(42) # just for reproducibility
>>> M = np.round(rand(5,5), decimals=2)
>>> M
array([[0.37, 0.95, 0.73, 0.6 , 0.16],
[0.16, 0.06, 0.87, 0.6 , 0.71],
[0.02, 0.97, 0.83, 0.21, 0.18],
[0.18, 0.3 , 0.52, 0.43, 0.29],
[0.61, 0.14, 0.29, 0.37, 0.46]])
>>> p = normlin(M.shape, .01)
>>> p(M)
array([[0.00264427, 0.00678935, 0.00521708, 0.00428801, 0.00114347],
[0.00124552, 0.00046707, 0.00677253, 0.00467071, 0.00552701],
[0.00015309, 0.00742494, 0.0063533 , 0.00160746, 0.00137782],
[0.00221263, 0.00368772, 0.00639205, 0.00528573, 0.0035648 ],
[0.00671873, 0.001542 , 0.00319415, 0.0040753 , 0.00506658]])

Constructor & Destructor Documentation

◆ __init__()

def pyfaust.proj.normlin.__init__ (   self,
  shape,
  s = 1 
)
Parameters
shape(tuple(int,int)) the input matrix shape.
s(float) the row 2-norm (default to 1).

Member Data Documentation

◆ constraint

pyfaust.proj.normlin.constraint

The documentation for this class was generated from the following file:
pyfaust.seed
def seed(s)
(Re)Initializes the pyfaust pseudo-random generator.
Definition: __init__.py:5268
pyfaust.rand
def rand(num_rows, num_cols, num_factors=None, dim_sizes=None, density=None, fac_type='sparse', per_row=True, dev='cpu', dtype='float64', field=None, seed=0)
Generates a random Faust.
Definition: __init__.py:4957
pyfaust.proj
This module provides matrix projectors.
Definition: proj.py:1