warp.optim.linear.LinearOperator#

class warp.optim.linear.LinearOperator(shape, dtype, device, matvec)[source]#

Linear operator to be used as left-hand-side of linear iterative solvers.

Parameters:
  • shape (tuple[int, int]) – Tuple containing the number of rows and columns of the operator

  • dtype (type) – Type of the operator elements

  • device (Device) – Device on which computations involving the operator should be performed

  • matvec (Callable) – Matrix-vector multiplication routine

The matrix-vector multiplication routine should have the following signature:

def matvec(x: wp.array, y: wp.array, z: wp.array, alpha: Scalar, beta: Scalar):
    '''Perform a generalized matrix-vector product.

    This function computes the operation z = alpha * (A @ x) + beta * y, where 'A'
    is the linear operator represented by this class.
    '''
    ...

For performance reasons, by default the iterative linear solvers in this module will try to capture the calls for one or more iterations in CUDA graphs. If the matvec routine of a custom LinearOperator cannot be graph-captured, the use_cuda_graph=False parameter should be passed to the solver function.

__init__(shape, dtype, device, matvec)[source]#
Parameters:

Methods

__init__(shape, dtype, device, matvec)

Attributes

property shape: tuple[int, int][source]#
property dtype: type[source]#
property device: Device[source]#
property matvec: Callable[source]#
property scalar_type[source]#