scipy 1.8.0 Pypi GitHub Homepage
Other Docs
ParametersReturns
interp_decomp(A, eps_or_k, rand=True)

An ID of a matrix A is a factorization defined by a rank k, a column index array idx , and interpolation coefficients :None:None:`proj` such that:

numpy.dot(A[:,idx[:k]], proj) = A[:,idx[k:]]

The original matrix can then be reconstructed as:

numpy.hstack([A[:,idx[:k]],
                            numpy.dot(A[:,idx[:k]], proj)]
                        )[:,numpy.argsort(idx)]

or via the routine reconstruct_matrix_from_id . This can equivalently be written as:

numpy.dot(A[:,idx[:k]],
                    numpy.hstack([numpy.eye(k), proj])
                  )[:,np.argsort(idx)]

in terms of the skeleton and interpolation matrices:

B = A[:,idx[:k]]

and:

P = numpy.hstack([numpy.eye(k), proj])[:,np.argsort(idx)]

respectively. See also reconstruct_interp_matrix and reconstruct_skel_matrix .

The ID can be computed to any relative precision or rank (depending on the value of :None:None:`eps_or_k`). If a precision is specified (:None:None:`eps_or_k < 1`), then this function has the output signature:

k, idx, proj = interp_decomp(A, eps_or_k)

Otherwise, if a rank is specified (:None:None:`eps_or_k >= 1`), then the output signature is:

idx, proj = interp_decomp(A, eps_or_k)
            <Comment: 
   |value: '..  This function automatically detects the form of the input parameters\n    and passes them to the appropriate backend. For details, see\n    :func:`_backend.iddp_id`, :func:`_backend.iddp_aid`,\n    :func:`_backend.iddp_rid`, :func:`_backend.iddr_id`,\n    :func:`_backend.iddr_aid`, :func:`_backend.iddr_rid`,\n    :func:`_backend.idzp_id`, :func:`_backend.idzp_aid`,\n    :func:`_backend.idzp_rid`, :func:`_backend.idzr_id`,\n    :func:`_backend.idzr_aid`, and :func:`_backend.idzr_rid`.'
   |>
           

Parameters

A : :class:`numpy.ndarray` or :class:`scipy.sparse.linalg.LinearOperator` with `rmatvec`

Matrix to be factored

eps_or_k : float or int

Relative error (if :None:None:`eps_or_k < 1`) or rank (if :None:None:`eps_or_k >= 1`) of approximation.

rand : bool, optional

Whether to use random sampling if A is of type numpy.ndarray (randomized algorithms are always used if A is of type scipy.sparse.linalg.LinearOperator ).

Returns

k : int

Rank required to achieve specified relative precision if :None:None:`eps_or_k < 1`.

idx : :class:`numpy.ndarray`

Column index array.

proj : :class:`numpy.ndarray`

Interpolation coefficients.

Compute ID of a matrix.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/linalg/interpolative.py#482
type: <class 'function'>
Commit: