Source code for qewton.backends.linalg
from abc import abstractmethod
from qewton.backends.base import Backend, TensorType
[docs]
class LinAlgBackend(Backend[TensorType]):
"""A Backend that implements linear algebra stuff such as
matrix system solving, eigendecomposition, etc.
"""
[docs]
@staticmethod
@abstractmethod
def svd(x: TensorType) -> tuple[TensorType, TensorType, TensorType]:
pass
[docs]
@staticmethod
@abstractmethod
def pca(x: TensorType, q=None) -> tuple[TensorType, TensorType, TensorType]:
pass
[docs]
@staticmethod
@abstractmethod
def norm(
x: TensorType, order: str | int = "fro", axis=None, keepdims=False
) -> TensorType:
pass
[docs]
@staticmethod
@abstractmethod
def det(x: TensorType) -> TensorType:
pass
[docs]
@staticmethod
@abstractmethod
def inv(x: TensorType) -> TensorType:
pass