pub trait TypedTensorLinalgExt<T: LinalgScalar> {
Show 21 methods
// Required methods
fn svd<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedSvd<T>>;
fn svd_with_options<B: LinalgBackend>(
&self,
options: SvdOptions,
backend: &mut B,
) -> Result<TypedSvd<T>>;
fn qr<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<(TypedTensor<T>, TypedTensor<T>)>;
fn qr_with_options<B: LinalgBackend>(
&self,
options: QrOptions,
backend: &mut B,
) -> Result<(TypedTensor<T>, TypedTensor<T>)>;
fn lu<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedLu<T>>;
fn full_piv_lu<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedFullPivLu<T>>;
fn full_piv_lu_solve<B: LinalgBackend>(
&self,
b: &TypedTensor<T>,
backend: &mut B,
) -> Result<TypedTensor<T>>;
fn solve<B: LinalgBackend>(
&self,
b: &TypedTensor<T>,
backend: &mut B,
) -> Result<TypedTensor<T>>;
fn cholesky<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedTensor<T>>;
fn eigh<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<(TypedTensor<<T as TensorScalar>::Real>, TypedTensor<T>)>;
fn eigh_with_options<B: LinalgBackend>(
&self,
options: EighOptions,
backend: &mut B,
) -> Result<(TypedTensor<<T as TensorScalar>::Real>, TypedTensor<T>)>;
fn eig<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedEig<T>>;
fn triangular_solve<B: LinalgBackend>(
&self,
b: &TypedTensor<T>,
left_side: bool,
lower: bool,
transpose_a: bool,
unit_diagonal: bool,
backend: &mut B,
) -> Result<TypedTensor<T>>;
fn slogdet<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<(TypedTensor<T>, TypedTensor<<T as TensorScalar>::Real>)>;
fn det<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>;
fn inv<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>;
fn eigvalsh<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedTensor<<T as TensorScalar>::Real>>;
fn eigvals<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedTensor<T::Complex>>;
fn pinv<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>;
fn pinv_with_rtol<B: LinalgBackend>(
&self,
rtol: f64,
backend: &mut B,
) -> Result<TypedTensor<T>>;
fn norm<B: LinalgBackend>(
&self,
ord: Option<f64>,
dim: Option<&[usize]>,
keepdim: bool,
backend: &mut B,
) -> Result<TypedTensor<<T as TensorScalar>::Real>>;
}Expand description
Linear algebra methods with statically typed inputs and outputs.
Singular values, Hermitian eigenvalues, determinant log-magnitudes, and
norms use T::Real; general eigenvalues and eigenvectors use T::Complex.
§Examples
use tenferro_cpu::{with_cpu_exec_session, CpuBackend};
use tenferro_linalg::TypedTensorLinalgExt;
use tenferro_tensor::{BackendSessionHost, TypedTensor};
let input = TypedTensor::<f64>::from_vec_col_major(
vec![2, 2],
vec![2.0, 0.0, 0.0, 4.0],
)?;
let mut host = CpuBackend::new();
let (_u, singular_values, _vt) = host.with_backend_session(|session| {
with_cpu_exec_session(session, |backend| input.svd(backend))
.expect("CpuBackend must expose a CpuExecSession")
})?;
assert_eq!(singular_values.as_slice()?, &[4.0, 2.0]);Required Methods§
Sourcefn svd<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedSvd<T>>
fn svd<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedSvd<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn svd_with_options<B: LinalgBackend>(
&self,
options: SvdOptions,
backend: &mut B,
) -> Result<TypedSvd<T>>
fn svd_with_options<B: LinalgBackend>( &self, options: SvdOptions, backend: &mut B, ) -> Result<TypedSvd<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation errors for metadata/options, plus backend or typed-output errors.
Sourcefn qr<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<(TypedTensor<T>, TypedTensor<T>)>
fn qr<B: LinalgBackend>( &self, backend: &mut B, ) -> Result<(TypedTensor<T>, TypedTensor<T>)>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn qr_with_options<B: LinalgBackend>(
&self,
options: QrOptions,
backend: &mut B,
) -> Result<(TypedTensor<T>, TypedTensor<T>)>
fn qr_with_options<B: LinalgBackend>( &self, options: QrOptions, backend: &mut B, ) -> Result<(TypedTensor<T>, TypedTensor<T>)>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation errors for metadata/options, plus backend or typed-output errors.
Sourcefn lu<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedLu<T>>
fn lu<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedLu<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn full_piv_lu<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedFullPivLu<T>>
fn full_piv_lu<B: LinalgBackend>( &self, backend: &mut B, ) -> Result<TypedFullPivLu<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn full_piv_lu_solve<B: LinalgBackend>(
&self,
b: &TypedTensor<T>,
backend: &mut B,
) -> Result<TypedTensor<T>>
fn full_piv_lu_solve<B: LinalgBackend>( &self, b: &TypedTensor<T>, backend: &mut B, ) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns incompatible-input validation, backend, singular, or typed-downcast errors.
Sourcefn solve<B: LinalgBackend>(
&self,
b: &TypedTensor<T>,
backend: &mut B,
) -> Result<TypedTensor<T>>
fn solve<B: LinalgBackend>( &self, b: &TypedTensor<T>, backend: &mut B, ) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns incompatible-input validation, backend, singular, or typed-downcast errors.
Sourcefn cholesky<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
fn cholesky<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns matrix validation, backend, positive-definiteness, or typed-downcast errors.
Sourcefn eigh<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<(TypedTensor<<T as TensorScalar>::Real>, TypedTensor<T>)>
fn eigh<B: LinalgBackend>( &self, backend: &mut B, ) -> Result<(TypedTensor<<T as TensorScalar>::Real>, TypedTensor<T>)>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, convergence, output-contract, or typed-downcast errors.
Sourcefn eigh_with_options<B: LinalgBackend>(
&self,
options: EighOptions,
backend: &mut B,
) -> Result<(TypedTensor<<T as TensorScalar>::Real>, TypedTensor<T>)>
fn eigh_with_options<B: LinalgBackend>( &self, options: EighOptions, backend: &mut B, ) -> Result<(TypedTensor<<T as TensorScalar>::Real>, TypedTensor<T>)>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation errors for metadata/options, plus backend or typed-output errors.
Sourcefn eig<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedEig<T>>
fn eig<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedEig<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, convergence, output-contract, or typed-downcast errors.
Sourcefn triangular_solve<B: LinalgBackend>(
&self,
b: &TypedTensor<T>,
left_side: bool,
lower: bool,
transpose_a: bool,
unit_diagonal: bool,
backend: &mut B,
) -> Result<TypedTensor<T>>
fn triangular_solve<B: LinalgBackend>( &self, b: &TypedTensor<T>, left_side: bool, lower: bool, transpose_a: bool, unit_diagonal: bool, backend: &mut B, ) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns incompatible-input/flag validation, backend, singular, or typed-output errors.
Sourcefn slogdet<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<(TypedTensor<T>, TypedTensor<<T as TensorScalar>::Real>)>
fn slogdet<B: LinalgBackend>( &self, backend: &mut B, ) -> Result<(TypedTensor<T>, TypedTensor<<T as TensorScalar>::Real>)>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn det<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
fn det<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn inv<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
fn inv<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, singular-solve, or typed-downcast errors.
Sourcefn eigvalsh<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedTensor<<T as TensorScalar>::Real>>
fn eigvalsh<B: LinalgBackend>( &self, backend: &mut B, ) -> Result<TypedTensor<<T as TensorScalar>::Real>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, convergence, output-contract, or typed-downcast errors.
Sourcefn eigvals<B: LinalgBackend>(
&self,
backend: &mut B,
) -> Result<TypedTensor<T::Complex>>
fn eigvals<B: LinalgBackend>( &self, backend: &mut B, ) -> Result<TypedTensor<T::Complex>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, convergence, output-contract, or typed-downcast errors.
Sourcefn pinv<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
fn pinv<B: LinalgBackend>(&self, backend: &mut B) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation, backend, numerical, output-contract, or typed-downcast errors.
Sourcefn pinv_with_rtol<B: LinalgBackend>(
&self,
rtol: f64,
backend: &mut B,
) -> Result<TypedTensor<T>>
fn pinv_with_rtol<B: LinalgBackend>( &self, rtol: f64, backend: &mut B, ) -> Result<TypedTensor<T>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns a validation error for invalid rtol, plus backend or typed-output errors.
Sourcefn norm<B: LinalgBackend>(
&self,
ord: Option<f64>,
dim: Option<&[usize]>,
keepdim: bool,
backend: &mut B,
) -> Result<TypedTensor<<T as TensorScalar>::Real>>
fn norm<B: LinalgBackend>( &self, ord: Option<f64>, dim: Option<&[usize]>, keepdim: bool, backend: &mut B, ) -> Result<TypedTensor<<T as TensorScalar>::Real>>
§Errors
Returns tenferro_tensor::Error::Unsupported when the selected backend does not support the operation.
Returns validation errors for axes/order combinations, backend, or typed-output errors.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.