-  3.39.23a0
Public Member Functions | Public Attributes | List of all members
pyfaust.proj.normcol Class Reference

Functor for the NORMCOL 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 NORMCOL projector.

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

Examples

>>> from pyfaust.proj import normcol
>>> 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 = normcol(M.shape, .01)
>>> norm(p(M)[:,0], 2)
0.009999999999999998

Constructor & Destructor Documentation

◆ __init__()

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

Member Data Documentation

◆ constraint

pyfaust.proj.normcol.constraint

The documentation for this class was generated from the following file:
pyfaust.norm
def norm(F, ord='fro', **kwargs)
Returns Faust.norm(F, ord) or numpy.linalg.norm(F, ord) depending of F type.
Definition: __init__.py:3894
pyfaust.seed
def seed(s)
(Re)Initializes the pyfaust pseudo-random generator.
Definition: __init__.py:5277
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:4966
pyfaust.proj
This module provides matrix projectors.
Definition: proj.py:1