Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
SparseMatrix.SparseMatrix Class Reference

Public Member Functions

 __init__ (self)
 
 set (self, row, col, val)
 
 get (self, row, col)
 
 print (self, indices)
 
 invert (self, indices)
 
 diagonal (self)
 
 __getitem__ (self, key)
 
 __setitem__ (self, key, value)
 

Protected Attributes

 _cpp_obj
 

Detailed Description

Python wrapper around the C++ sparse matrix class.

The wrapper exposes only a minimal API: element assignment/access, inversion
on a selected index set, and inspection of diagonal entries. It is intended
for advanced users who need direct access to sparse matrix primitives in the
C++ math module.

Example:
    >>> M = SparseMatrix()
    >>> M[0, 1] = 2.0
    >>> M[0, 1]
    2.0

Definition at line 6 of file SparseMatrix.py.

Constructor & Destructor Documentation

◆ __init__()

SparseMatrix.SparseMatrix.__init__ (   self)
Create an empty sparse matrix backed by C++.

Definition at line 21 of file SparseMatrix.py.

Member Function Documentation

◆ __getitem__()

SparseMatrix.SparseMatrix.__getitem__ (   self,
  key 
)
Return ``self[row, col]``.

Definition at line 78 of file SparseMatrix.py.

◆ __setitem__()

SparseMatrix.SparseMatrix.__setitem__ (   self,
  key,
  value 
)
Set ``self[row, col] = value``.

Definition at line 83 of file SparseMatrix.py.

◆ diagonal()

SparseMatrix.SparseMatrix.diagonal (   self)
Return the sparse matrix diagonal entries.

Returns:
    Any: Container returned by the C++ binding.

Definition at line 70 of file SparseMatrix.py.

◆ get()

SparseMatrix.SparseMatrix.get (   self,
  row,
  col 
)
Return one matrix entry.

Args:
    row: Row index.
    col: Column index.

Returns:
    float: Stored value returned by the C++ sparse matrix.

Definition at line 35 of file SparseMatrix.py.

◆ invert()

SparseMatrix.SparseMatrix.invert (   self,
  indices 
)
Invert a selected sparse submatrix.

Args:
    indices: Row/column indices defining the submatrix to invert.

Returns:
    SparseMatrix: Python wrapper around the inverted C++ matrix.

Definition at line 56 of file SparseMatrix.py.

◆ print()

SparseMatrix.SparseMatrix.print (   self,
  indices 
)
Print a selected sparse submatrix using the C++ debug printer.

Args:
    indices: Indices to print. The exact accepted container mirrors the
        C++ binding.

Definition at line 47 of file SparseMatrix.py.

◆ set()

SparseMatrix.SparseMatrix.set (   self,
  row,
  col,
  val 
)
Set one matrix entry.

Args:
    row: Row index.
    col: Column index.
    val: Numeric value assigned to ``(row, col)``.

Definition at line 25 of file SparseMatrix.py.

Member Data Documentation

◆ _cpp_obj

SparseMatrix.SparseMatrix._cpp_obj
protected

Definition at line 23 of file SparseMatrix.py.


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