FiniteDifference1D

A one-dimensional finite difference derivative object. Higher-dimensional derivatives are built by chaining these.

 

__init__(self, finite_difference_data, matrix): 

 

@property
order(self): 

 

@property
weights(self): 

 

@property
widths(self): 

 

get_stencil(order, stencil, accuracy): 

 

apply(self, vals, val_dim=None, axis=0, mesh_spacing=None, check_shape=True): 

Applies the held FiniteDifferenceMatrix to the array of values

  • vals: np.ndarray | sparse.csr_matrix

    values to do the difference over

  • val_dim: int

    dimensions of the vals

  • axis: int | tuple[int]

    the axis to apply along

  • mesh_spacing: float

    the mesh spacing for the weights

  • :returns: np.ndarray

 

sparse_tensordot(sparse, mat, axis): 

Not sure how fast this will be, but does a very simple contraction of mat along axis by the final axis of sparse

Heavily de-generalized from here: https://github.com/pydata/sparse/blob/9dc40e15a04eda8d8efff35dfc08950b4c07a810/sparse/_coo/common.py

  • sparse: sparse.sparsemat
  • mat: np.ndarray
  • axis: Any
  • :returns: _

Examples

FiniteDifference1D

A one-dimensional finite difference derivative object. Higher-dimensional derivatives are built by chaining these.

Properties and Methods

get_stencil: method

 

__init__(self, finite_difference_data, matrix): 

 

@property
order(self): 

 

@property
weights(self): 

 

@property
widths(self): 

 

apply(self, vals, val_dim=None, axis=0, mesh_spacing=None): 

Applies the held FiniteDifferenceMatrix to the array of values

  • vals: np.ndarray | sparse.csr_matrix

    values to do the difference over

  • val_dim: int

    dimensions of the vals

  • axis: int | tuple[int]

    the axis to apply along

  • mesh_spacing: float

    the mesh spacing for the weights

  • :returns: np.ndarray

    No description…

 

sparse_tensordot(sparse, mat, axis): 

Not sure how fast this will be, but does a very simple contraction of mat along axis by the final axis of sparse

    Heavily de-generalized from here: https://github.com/pydata/sparse/blob/9dc40e15a04eda8d8efff35dfc08950b4c07a810/sparse/_coo/common.py - `sparse`: `sparse.sparsemat`
>No description... - `mat`: `np.ndarray`
>No description... - `axis`: `Any`
>No description... - `:returns`: `_`
>No description...

Examples


Edit Examples or Create New Examples
Edit Template or Create New Template
Edit Docstrings


Feedback

Examples

Templates

Documentation