Struct SparseTensor

Source
pub struct SparseTensor<T = f64>
where T: Number,
{ /* private fields */ }

Implementations§

Source§

impl<T> SparseTensor<T>
where T: Number,

Source

pub fn direct(&self, rhs: &Self) -> Self

Source§

impl<T> SparseTensor<T>
where T: Number,

Source

pub fn dot(&self, rhs: &Self, rank_pairs: &[[RankIndex; 2]]) -> Self

Source§

impl<T> SparseTensor<T>
where T: Number,

Source

pub fn mul_kronecker_deltas( &self, deltas: &[KroneckerDelta], ) -> Result<Self, TensorError>

Source§

impl<T> SparseTensor<T>
where T: Number,

Source

pub fn new(sizes: Vec<usize>) -> Self

Source

pub fn from( sizes: Vec<usize>, elems: HashMap<Vec<usize>, T>, ) -> Result<Self, TensorError>

Source

pub fn is_same_size(&self, other: &SparseTensor<T>) -> bool

Source

pub fn total_size(&self) -> usize

Source

pub fn not_1dimension_ranks(&self) -> usize

Source

pub fn reduce_1dimension_rank(&self) -> Self

Source

pub fn to_vec(&self) -> Vec<T>

Source

pub fn to_mat(&self) -> Matrix<T>

Source

pub fn elems(&self) -> &HashMap<Vec<usize>, T>

Source

pub fn elems_mut(&mut self) -> &mut HashMap<Vec<usize>, T>

Source

pub fn eject(self) -> (Vec<usize>, HashMap<Vec<usize>, T>)

Trait Implementations§

Source§

impl<T> Add<&SparseTensor<T>> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &SparseTensor<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<SparseTensor<Complex<f64>>> for &c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<SparseTensor<Complex<f64>>> for c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<SparseTensor<T>> for &SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparseTensor<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<SparseTensor> for &f64

Source§

type Output = SparseTensor

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<SparseTensor> for f64

Source§

type Output = SparseTensor

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: SparseTensor<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> AddAssign for SparseTensor<T>
where T: Number,

Source§

fn add_assign(&mut self, rhs: SparseTensor<T>)

Performs the += operation. Read more
Source§

impl<T> Clone for SparseTensor<T>
where T: Number + Clone,

Source§

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

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for SparseTensor<T>
where T: Number + Debug,

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de, T> Deserialize<'de> for SparseTensor<T>
where T: Number + Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Div<&SparseTensor<T>> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &SparseTensor<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<SparseTensor<Complex<f64>>> for &c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<SparseTensor<Complex<f64>>> for c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<SparseTensor<T>> for &SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: SparseTensor<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<SparseTensor> for &f64

Source§

type Output = SparseTensor

The resulting type after applying the / operator.
Source§

fn div(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<SparseTensor> for f64

Source§

type Output = SparseTensor

The resulting type after applying the / operator.
Source§

fn div(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: SparseTensor<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> DivAssign for SparseTensor<T>
where T: Number,

Source§

fn div_assign(&mut self, rhs: SparseTensor<T>)

Performs the /= operation. Read more
Source§

impl<T> From<Vec<T>> for SparseTensor<T>
where T: Number,

Source§

fn from(vec: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> Index<&[usize]> for SparseTensor<T>
where T: Number,

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: &[usize]) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<&[usize]> for SparseTensor<T>
where T: Number,

Source§

fn index_mut(&mut self, index: &[usize]) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> Mul<&SparseTensor<T>> for KroneckerDelta
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&SparseTensor<T>> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&SparseTensor<T>> for Vec<KroneckerDelta>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<KroneckerDelta> for &SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: KroneckerDelta) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<KroneckerDelta> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: KroneckerDelta) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SparseTensor<Complex<f64>>> for &c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SparseTensor<Complex<f64>>> for c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<SparseTensor<T>> for &SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<SparseTensor<T>> for KroneckerDelta
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<SparseTensor<T>> for Vec<KroneckerDelta>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SparseTensor> for &f64

Source§

type Output = SparseTensor

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<SparseTensor> for f64

Source§

type Output = SparseTensor

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<Vec<KroneckerDelta>> for &SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec<KroneckerDelta>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<Vec<KroneckerDelta>> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Vec<KroneckerDelta>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: SparseTensor<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> MulAssign for SparseTensor<T>
where T: Number,

Source§

fn mul_assign(&mut self, rhs: SparseTensor<T>)

Performs the *= operation. Read more
Source§

impl<T> Neg for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> PartialEq for SparseTensor<T>
where T: Number + PartialEq,

Source§

fn eq(&self, other: &SparseTensor<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

const fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Serialize for SparseTensor<T>
where T: Number + Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T> Sub<&SparseTensor<T>> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &SparseTensor<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<SparseTensor<Complex<f64>>> for &c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<SparseTensor<Complex<f64>>> for c64

Source§

type Output = SparseTensor<Complex<f64>>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparseTensor<c64>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<SparseTensor<T>> for &SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparseTensor<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<SparseTensor> for &f64

Source§

type Output = SparseTensor

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<SparseTensor> for f64

Source§

type Output = SparseTensor

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparseTensor<f64>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<T> for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for SparseTensor<T>
where T: Number,

Source§

type Output = SparseTensor<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: SparseTensor<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> SubAssign for SparseTensor<T>
where T: Number,

Source§

fn sub_assign(&mut self, rhs: SparseTensor<T>)

Performs the -= operation. Read more
Source§

impl<T> Tensor<T> for SparseTensor<T>
where T: Number,

Source§

fn rank(&self) -> usize

Source§

fn size(&self, rank: RankIndex) -> usize

Source§

fn elem(&self, indices: &[usize]) -> T

Source§

fn elem_mut(&mut self, indices: &[usize]) -> &mut T

Source§

impl<T> StructuralPartialEq for SparseTensor<T>
where T: Number,

Auto Trait Implementations§

§

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

§

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

§

impl<T> Send for SparseTensor<T>

§

impl<T> Sync for SparseTensor<T>

§

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

§

impl<T> UnwindSafe for SparseTensor<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
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.

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,