Skip to main content

HouseholderQr

Struct HouseholderQr 

Source
pub struct HouseholderQr<T> { /* private fields */ }
Expand description

Opaque compact Householder QR state.

The packed reflector tensors remain private so callers cannot accidentally treat provider state as ordinary tensor values.

§Examples

use tenferro_cpu::CpuBackend;
use tenferro_linalg::{QrOptions, TensorLinalgExt};
use tenferro_tensor::{BackendSessionHost, Tensor};

let a = Tensor::from_vec_col_major(
    vec![3, 2],
    vec![1.0_f64, 0.0, 1.0, 0.0, 1.0, 1.0],
)?;
let mut host = CpuBackend::new();
let r = host.with_backend_session(|session| {
    let qr = a.householder_qr(session)?;
    qr.r(QrOptions::default(), session)
})?;
assert_eq!(r.shape(), &[2, 2]);

Implementations§

Source§

impl HouseholderQr<Tensor>

Source

pub fn from_factors( q: &Tensor, r: &Tensor, session: &mut dyn BackendSession, ) -> Result<Self>

Construct compact state for the product of compatible factors Q * R.

§Errors

Returns tenferro_tensor::Error::Validation for incompatible rank, shape, dtype, placement, or a non-trapezoidal R factor; tenferro_tensor::Error::Unsupported when the provider lacks compact QR; or tenferro_tensor::Error::BackendSource for provider failures.

Source

pub fn append_columns( &self, block: &Tensor, session: &mut dyn BackendSession, ) -> Result<Self>

Append a column block without refactorizing existing columns.

§Errors

Returns tenferro_tensor::Error::Validation for incompatible shape, dtype, placement, or malformed state; tenferro_tensor::Error::Unsupported when append is unavailable; or tenferro_tensor::Error::BackendSource for reflector or factorization failures.

Source

pub fn r( &self, options: QrOptions, session: &mut dyn BackendSession, ) -> Result<Tensor>

Extract the thin upper-trapezoidal factor.

§Errors

Returns tenferro_tensor::Error::Validation for malformed state, tenferro_tensor::Error::Unsupported for an unavailable provider path, or tenferro_tensor::Error::BackendSource for extraction failures.

Source

pub fn q_columns( &self, columns: Range<usize>, options: QrOptions, session: &mut dyn BackendSession, ) -> Result<Tensor>

Materialize a contiguous range of thin-Q columns.

§Errors

Returns tenferro_tensor::Error::Validation when the range is outside the thin-Q width or state metadata is malformed, tenferro_tensor::Error::Unsupported for an unavailable provider path, or tenferro_tensor::Error::BackendSource for execution failures.

Source§

impl HouseholderQr<EagerTensor>

Source

pub fn from_factors(q: &EagerTensor, r: &EagerTensor) -> Result<Self>

Construct compact state from compatible eager factors.

§Errors

Returns tenferro_ad::Error::Validation for known invalid metadata, tenferro_ad::Error::Extension for unsupported or provider failures, or tenferro_ad::Error::RuntimeState when eager execution is unavailable.

Source

pub fn append_columns(&self, block: &EagerTensor) -> Result<Self>

Append an eager column block functionally.

§Errors

Returns tenferro_ad::Error::Validation for known invalid metadata, tenferro_ad::Error::Extension for unsupported or provider failures, or tenferro_ad::Error::RuntimeState when eager execution is unavailable.

Source

pub fn r(&self, options: QrOptions) -> Result<EagerTensor>

Extract eager R.

§Errors

Returns tenferro_ad::Error::Validation for known invalid metadata, tenferro_ad::Error::Extension for unsupported or provider failures, or tenferro_ad::Error::RuntimeState when eager execution is unavailable.

Source

pub fn q_columns( &self, columns: Range<usize>, options: QrOptions, ) -> Result<EagerTensor>

Materialize eager thin-Q columns.

§Errors

Returns tenferro_ad::Error::Validation for known invalid metadata, tenferro_ad::Error::Extension for unsupported or provider failures, or tenferro_ad::Error::RuntimeState when eager execution is unavailable.

Source§

impl HouseholderQr<TracedTensor>

Source

pub fn from_factors(q: &TracedTensor, r: &TracedTensor) -> Result<Self>

Construct compact state from compatible traced factors.

§Errors

Returns tenferro_runtime::Error::Validation for known invalid metadata or tenferro_runtime::Error::Extension for unsupported operation state.

§Deferred errors

Symbolic shape constraints and backend provider failures may be reported during compile or execution.

Source

pub fn append_columns(&self, block: &TracedTensor) -> Result<Self>

Append a traced column block functionally.

§Errors

Returns tenferro_runtime::Error::Validation for known invalid metadata or tenferro_runtime::Error::Extension for unsupported operation state.

§Deferred errors

Symbolic shape constraints and backend provider failures may be reported during compile or execution.

Source

pub fn r(&self, options: QrOptions) -> Result<TracedTensor>

Extract traced R.

§Errors

Returns tenferro_runtime::Error::Validation for known invalid metadata or tenferro_runtime::Error::Extension for unsupported operation state.

§Deferred errors

Symbolic shape constraints and backend provider failures may be reported during compile or execution.

Source

pub fn q_columns( &self, columns: Range<usize>, options: QrOptions, ) -> Result<TracedTensor>

Materialize traced thin-Q columns.

§Errors

Returns tenferro_runtime::Error::Validation for known invalid metadata or tenferro_runtime::Error::Extension for unsupported operation state.

§Deferred errors

Symbolic shape constraints and backend provider failures may be reported during compile or execution.

Trait Implementations§

Source§

impl<T: Clone> Clone for HouseholderQr<T>

Source§

fn clone(&self) -> HouseholderQr<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for HouseholderQr<T>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for HouseholderQr<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for HouseholderQr<T>
where T: RefUnwindSafe,

§

impl<T> Send for HouseholderQr<T>
where T: Send,

§

impl<T> Sync for HouseholderQr<T>
where T: Sync,

§

impl<T> Unpin for HouseholderQr<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for HouseholderQr<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for HouseholderQr<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSendSync for T
where T: Send + Sync,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.