Matrix

The matrix module defines a number of 2D matrix objects, notably the ScipyMatrix() and NumpyMatrix(). Matrix objects support basic addition and subtraction operations and provide a consistent insterface for solving linear systems. Matrices can be converted to numpy arrays via toarray or scipy matrices via toscipy.

class nutils.matrix.Matrix(shape)[source]

matrix base class

cond(constrain=None, lconstrain=None, rconstrain=None)[source]

condition number

res(x, b=0, constrain=None, lconstrain=None, rconstrain=None, scaled=True)[source]

residual

class nutils.matrix.ScipyMatrix(core)[source]

matrix based on any of scipy’s sparse matrices

rowsupp(tol=0)[source]

return row indices with nonzero/non-small entries

solve(rhs=None, constrain=None, lconstrain=None, rconstrain=None, tol=0, lhs0=None, solver=None, symmetric=False, callback=None, precon=None, **solverargs)[source]
class nutils.matrix.NumpyMatrix(core)[source]

matrix based on numpy array

solve(b=None, constrain=None, lconstrain=None, rconstrain=None, tol=0)[source]
nutils.matrix.assemble(data, index, shape, force_dense=False)[source]

create data from values and indices

nutils.matrix.parsecons(constrain, lconstrain, rconstrain, shape)[source]

parse constraints