pub trait TracedTensorLinalgExt {
Show 25 methods
// Required methods
fn svd(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor)>;
fn svd_with_options(
&self,
options: SvdOptions,
) -> Result<(TracedTensor, TracedTensor, TracedTensor)>;
fn svd_full(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor)>;
fn qr(&self) -> Result<(TracedTensor, TracedTensor)>;
fn householder_qr(&self) -> Result<HouseholderQr<TracedTensor>>;
fn qr_with_options(
&self,
options: QrOptions,
) -> Result<(TracedTensor, TracedTensor)>;
fn rank_revealing_qr(
&self,
options: RankRevealingQrOptions,
) -> Result<RankRevealingQrResult<TracedTensor>>;
fn eigh(&self) -> Result<(TracedTensor, TracedTensor)>;
fn eigh_with_options(
&self,
options: EighOptions,
) -> Result<(TracedTensor, TracedTensor)>;
fn cholesky(&self) -> Result<TracedTensor>;
fn lu(
&self,
) -> Result<(TracedTensor, TracedTensor, TracedTensor, TracedTensor)>;
fn full_piv_lu(
&self,
) -> Result<(TracedTensor, TracedTensor, TracedTensor, TracedTensor, TracedTensor)>;
fn eig(&self) -> Result<(TracedTensor, TracedTensor)>;
fn solve(&self, b: &TracedTensor) -> Result<TracedTensor>;
fn lstsq(&self, b: &TracedTensor) -> Result<TracedTensor>;
fn full_piv_lu_solve(&self, b: &TracedTensor) -> Result<TracedTensor>;
fn triangular_solve(
&self,
b: &TracedTensor,
left_side: bool,
lower: bool,
transpose_a: bool,
unit_diagonal: bool,
) -> Result<TracedTensor>;
fn slogdet(&self) -> Result<(TracedTensor, TracedTensor)>;
fn det(&self) -> Result<TracedTensor>;
fn inv(&self) -> Result<TracedTensor>;
fn eigvalsh(&self) -> Result<TracedTensor>;
fn eigvals(&self) -> Result<TracedTensor>;
fn pinv(&self) -> Result<TracedTensor>;
fn pinv_with_rtol(&self, rtol: f64) -> Result<TracedTensor>;
fn norm(
&self,
ord: Option<f64>,
dim: Option<&[usize]>,
keepdim: bool,
) -> Result<TracedTensor>;
}Expand description
Linear algebra extension methods for TracedTensor.
Required Methods§
Sourcefn svd(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor)>
fn svd(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor)>
Build a traced SVD operation with default options.
§Errors
Returns Error::Extension with ErrorKind::Unsupported for an
unsupported dtype, or Error::Validation for invalid graph metadata.
§Deferred errors
Backend numerical failures and concrete shape mismatches can be
reported as Error::Extension or Error::Validation during compile or
execution when symbolic inputs are bound.
Sourcefn svd_with_options(
&self,
options: SvdOptions,
) -> Result<(TracedTensor, TracedTensor, TracedTensor)>
fn svd_with_options( &self, options: SvdOptions, ) -> Result<(TracedTensor, TracedTensor, TracedTensor)>
Build a traced SVD operation with explicit derivative and gauge options.
§Errors
Returns Error::Validation::InvalidArgument for a non-finite or
non-positive derivative epsilon, or Error::Extension for unsupported
dtype and graph registration failures.
§Deferred errors
Solver convergence and symbolic shape checks may be reported during compile or execution.
Sourcefn svd_full(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor)>
fn svd_full(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor)>
Build a traced full-matrices SVD operation returning square U (m x m)
and Vh (n x n), whose trailing n - rank rows span the input’s right
nullspace.
§Errors
Returns Error::Validation when the input is not a batched matrix
(rank >= 2), Error::Extension with ErrorKind::Unsupported for
integer or boolean dtypes, or Error::Extension for graph
registration failures.
§Deferred errors
The active backend returns Error::Extension with
ErrorKind::Unsupported at execution if it does not implement
full-matrices SVD; both CPU providers and the CUDA backend implement
it. Automatic differentiation is intentionally unsupported for the full
variant (see the linalg AD support manifest) and surfaces a typed AD
error rather than a silent thin-SVD fallback.
Sourcefn qr(&self) -> Result<(TracedTensor, TracedTensor)>
fn qr(&self) -> Result<(TracedTensor, TracedTensor)>
Sourcefn householder_qr(&self) -> Result<HouseholderQr<TracedTensor>>
fn householder_qr(&self) -> Result<HouseholderQr<TracedTensor>>
Build opaque compact Householder QR state.
§Errors
Returns Error::Validation for known invalid graph metadata or
Error::Extension for an unsupported operation.
§Deferred errors
Symbolic shape and backend provider checks may fail at compile or execution.
§Examples
use tenferro_linalg::TracedTensorLinalgExt;
use tenferro_runtime::TracedTensor;
let a = TracedTensor::from_vec_col_major(vec![2, 1], vec![1.0_f64, 2.0])?;
let qr = a.householder_qr()?;
assert!(format!("{qr:?}").starts_with("HouseholderQr"));Sourcefn qr_with_options(
&self,
options: QrOptions,
) -> Result<(TracedTensor, TracedTensor)>
fn qr_with_options( &self, options: QrOptions, ) -> Result<(TracedTensor, TracedTensor)>
Sourcefn rank_revealing_qr(
&self,
options: RankRevealingQrOptions,
) -> Result<RankRevealingQrResult<TracedTensor>>
fn rank_revealing_qr( &self, options: RankRevealingQrOptions, ) -> Result<RankRevealingQrResult<TracedTensor>>
Build fixed-arity traced column-pivoted rank-revealing QR.
§Errors
Returns graph-build validation errors for rank, dtype, or invalid tolerances, and extension registration failures.
§Deferred errors
Symbolic shape checks, non-finite numerical failures, and unsupported backend execution are reported during compile or execution.
§Examples
use tenferro_linalg::{RankRevealingQrOptions, TracedTensorLinalgExt};
use tenferro_runtime::TracedTensor;
let a = TracedTensor::from_vec_col_major(vec![2, 3], vec![1.0_f64, 0.0, 0.0, 1.0, 1.0, 1.0])?;
let result = a.rank_revealing_qr(RankRevealingQrOptions::default())?;
assert_eq!(result.q.rank, 2);
assert_eq!(result.column_permutation.rank, 1);
assert_eq!(result.rank.rank, 0);Sourcefn eigh(&self) -> Result<(TracedTensor, TracedTensor)>
fn eigh(&self) -> Result<(TracedTensor, TracedTensor)>
Build a traced Hermitian eigendecomposition operation.
§Errors
Returns Error::Extension with ErrorKind::Unsupported for an
unsupported dtype or Error::Validation for invalid graph metadata.
§Deferred errors
Concrete square-shape validation and solver failures may be reported at compile or execution time.
Sourcefn eigh_with_options(
&self,
options: EighOptions,
) -> Result<(TracedTensor, TracedTensor)>
fn eigh_with_options( &self, options: EighOptions, ) -> Result<(TracedTensor, TracedTensor)>
Build a traced Hermitian eigendecomposition with explicit options.
§Errors
Returns Error::Validation::InvalidArgument for an invalid derivative
epsilon, or Error::Extension for unsupported dtype and registration
failures.
§Deferred errors
Symbolic square-shape checks and numerical eigensolver failures may be reported during compile or execution.
Sourcefn cholesky(&self) -> Result<TracedTensor>
fn cholesky(&self) -> Result<TracedTensor>
Build a traced Cholesky factorization operation.
§Errors
Returns Error::Extension with ErrorKind::Unsupported for an
unsupported dtype or Error::Validation for invalid graph metadata.
§Deferred errors
Non-square or non-positive-definite concrete inputs can produce validation or numerical extension errors during compile or execution.
Sourcefn lu(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor, TracedTensor)>
fn lu(&self) -> Result<(TracedTensor, TracedTensor, TracedTensor, TracedTensor)>
Sourcefn full_piv_lu(
&self,
) -> Result<(TracedTensor, TracedTensor, TracedTensor, TracedTensor, TracedTensor)>
fn full_piv_lu( &self, ) -> Result<(TracedTensor, TracedTensor, TracedTensor, TracedTensor, TracedTensor)>
Build a traced complete-pivot LU factorization operation.
§Errors
Returns Error::Extension with ErrorKind::Unsupported for an
unsupported dtype or Error::Validation for invalid graph metadata.
§Deferred errors
Concrete square-shape checks and backend factorization failures may be reported during compile or execution.
Sourcefn eig(&self) -> Result<(TracedTensor, TracedTensor)>
fn eig(&self) -> Result<(TracedTensor, TracedTensor)>
Build a traced general eigendecomposition operation.
§Errors
Returns Error::Extension with ErrorKind::Unsupported for an
unsupported dtype or Error::Validation for invalid graph metadata.
§Deferred errors
Concrete shape validation and numerical eigensolver failures may be reported during compile or execution.
Sourcefn solve(&self, b: &TracedTensor) -> Result<TracedTensor>
fn solve(&self, b: &TracedTensor) -> Result<TracedTensor>
Build a traced linear solve operation.
The CUDA provider does not inspect the cuSOLVER getrf status flag on
the forward solve path, so it performs no per-call non-singularity check
and issues no host round trip. An exactly singular input is left to the
caller’s verification, as in torch.linalg.solve. CPU providers may
still report their own exactly singular factor as Error::Singular.
§Errors
Returns Error::Validation for incompatible coefficient/rhs metadata
and Error::Extension for unsupported dtype or registration failures.
§Deferred errors
Singular systems and concrete shape mismatches are reported as numerical or validation errors during compile or execution.
Sourcefn lstsq(&self, b: &TracedTensor) -> Result<TracedTensor>
fn lstsq(&self, b: &TracedTensor) -> Result<TracedTensor>
Build a traced least-squares solve argmin_x ||A x - b||_2 for a tall
or square, full-column-rank A, via the thin QR factorization.
§Errors
Returns Error::Validation for an invalid rank (A or b not a
batched matrix, rank < 2), a symbolic shape, a wide/underdetermined
A (rows < cols), or an unsupported dtype (not floating-point or
complex).
§Deferred errors
Backend QR and triangular-solve failures and concrete shape mismatches
are reported during compile or execution. Rank-deficient A is not
detected: R is singular and the result is ill-defined, so callers must
ensure full column rank.
Sourcefn full_piv_lu_solve(&self, b: &TracedTensor) -> Result<TracedTensor>
fn full_piv_lu_solve(&self, b: &TracedTensor) -> Result<TracedTensor>
Build a traced complete-pivot LU solve operation.
§Errors
Returns Error::Validation for incompatible coefficient/rhs metadata
and Error::Extension for unsupported dtype or registration failures.
§Deferred errors
Singular systems and concrete shape mismatches may be reported during compile or execution.
Sourcefn triangular_solve(
&self,
b: &TracedTensor,
left_side: bool,
lower: bool,
transpose_a: bool,
unit_diagonal: bool,
) -> Result<TracedTensor>
fn triangular_solve( &self, b: &TracedTensor, left_side: bool, lower: bool, transpose_a: bool, unit_diagonal: bool, ) -> Result<TracedTensor>
Build a traced triangular solve operation.
§Errors
Returns Error::Validation for incompatible coefficient/rhs shapes or
invalid solve flags, and Error::Extension for unsupported dtype.
§Deferred errors
Singular or zero-diagonal systems can fail numerically during compile or execution after symbolic inputs are bound.
Sourcefn slogdet(&self) -> Result<(TracedTensor, TracedTensor)>
fn slogdet(&self) -> Result<(TracedTensor, TracedTensor)>
Sourcefn det(&self) -> Result<TracedTensor>
fn det(&self) -> Result<TracedTensor>
Sourcefn inv(&self) -> Result<TracedTensor>
fn inv(&self) -> Result<TracedTensor>
Sourcefn eigvalsh(&self) -> Result<TracedTensor>
fn eigvalsh(&self) -> Result<TracedTensor>
Sourcefn eigvals(&self) -> Result<TracedTensor>
fn eigvals(&self) -> Result<TracedTensor>
Sourcefn pinv(&self) -> Result<TracedTensor>
fn pinv(&self) -> Result<TracedTensor>
Sourcefn pinv_with_rtol(&self, rtol: f64) -> Result<TracedTensor>
fn pinv_with_rtol(&self, rtol: f64) -> Result<TracedTensor>
Build a traced pseudoinverse with an explicit relative tolerance.
§Errors
Returns Error::Validation::InvalidArgument when rtol is non-finite
or negative, or Error::Extension for unsupported dtype.
§Deferred errors
SVD convergence and concrete shape failures may be reported during compile or execution.
Sourcefn norm(
&self,
ord: Option<f64>,
dim: Option<&[usize]>,
keepdim: bool,
) -> Result<TracedTensor>
fn norm( &self, ord: Option<f64>, dim: Option<&[usize]>, keepdim: bool, ) -> Result<TracedTensor>
Build a traced vector/matrix norm operation.
§Errors
Requires a concrete shape immediately. Returns Error::Validation for
invalid or duplicate axes or an invalid norm order. Symbolic shapes
produce Error::TensorRuntime wrapping ValidationError::InvalidArgument
for shape during graph construction; unsupported dtypes produce
Error::Extension.
§Deferred errors
Backend numerical or runtime failures may occur during execution.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".