Struct tc_tensor::SparseTensor [−][src]
pub struct SparseTensor<FD, FS, D, T, A> { /* fields omitted */ }
Expand description
A Tensor
stored as a Table
of Coord
s and [Number
] values
Implementations
Consume this SparseTensor
and return its accessor.
Trait Implementations
impl<FD, FS, D, T, A> CopyFrom<D, SparseTensor<FD, FS, D, T, A>> for SparseTable<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<BTreeType> + From<TensorType>,
impl<FD, FS, D, T, A> CopyFrom<D, SparseTensor<FD, FS, D, T, A>> for SparseTable<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<BTreeType> + From<TensorType>,
impl<FD, FS, D, T, A> CopyFrom<D, SparseTensor<FD, FS, D, T, A>> for SparseTensor<FD, FS, D, T, SparseTable<FD, FS, D, T>> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<BTreeType> + From<TensorType>,
impl<FD, FS, D, T, A> CopyFrom<D, SparseTensor<FD, FS, D, T, A>> for SparseTensor<FD, FS, D, T, SparseTable<FD, FS, D, T>> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<BTreeType> + From<TensorType>,
impl<FD, FS, D, T, A> From<SparseTensor<FD, FS, D, T, A>> for Tensor<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> From<SparseTensor<FD, FS, D, T, A>> for Tensor<FD, FS, D, T> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Performs the conversion.
impl<FD, FS, D, T> FromStream for SparseTensor<FD, FS, D, T, SparseTable<FD, FS, D, T>> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
D::FileClass: From<BTreeType> + From<TensorType>,
impl<FD, FS, D, T> FromStream for SparseTensor<FD, FS, D, T, SparseTable<FD, FS, D, T>> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
D::FileClass: From<BTreeType> + From<TensorType>,
type Context = T
type Context = T
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
fn from_stream<'life0, 'async_trait, De: Decoder>(
txn: T,
decoder: &'life0 mut De
) -> Pin<Box<dyn Future<Output = Result<Self, De::Error>> + Send + 'async_trait>> where
De: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
fn from_stream<'life0, 'async_trait, De: Decoder>(
txn: T,
decoder: &'life0 mut De
) -> Pin<Box<dyn Future<Output = Result<Self, De::Error>> + Send + 'async_trait>> where
De: 'async_trait,
'life0: 'async_trait,
Self: 'async_trait,
Parse this value using the given Decoder
.
impl<'en, FD, FS, D, T, A> Hash<'en, D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
impl<'en, FD, FS, D, T, A> Hash<'en, D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
type Txn = T
fn hashable<'async_trait>(
&'en self,
txn: &'en Self::Txn
) -> Pin<Box<dyn Future<Output = TCResult<TCBoxTryStream<'en, (Coord, Number)>>> + Send + 'async_trait>> where
'en: 'async_trait,
Self: 'async_trait,
impl<'en, FD, FS, D, T, A> IntoView<'en, D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<'en, FD, FS, D, T, A> IntoView<'en, D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorAccess for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
impl<FD, FS, D, T, A> TensorAccess for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
impl<FD, FS, D, T, L, R> TensorBoolean<SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
L: SparseAccess<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
impl<FD, FS, D, T, L, R> TensorBoolean<SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
L: SparseAccess<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
type Combine = SparseTensor<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>
type Combine = SparseTensor<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>
The result type of a boolean operation.
type LeftCombine = SparseTensor<FD, FS, D, T, SparseLeftCombinator<FD, FS, D, T, L, R>>
type LeftCombine = SparseTensor<FD, FS, D, T, SparseLeftCombinator<FD, FS, D, T, L, R>>
The result type of a boolean operation which may ignore right-hand values.
Logical and
Logical or
Logical xor
impl<FD, FS, D, T, A> TensorBoolean<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorBoolean<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type LeftCombine = Tensor<FD, FS, D, T>
type LeftCombine = Tensor<FD, FS, D, T>
The result type of a boolean operation which may ignore right-hand values.
impl<FD, FS, D, T, L, R> TensorCompare<SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
L: SparseAccess<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, L, R> TensorCompare<SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
L: SparseAccess<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type Compare = SparseTensor<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>
type Compare = SparseTensor<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>
The result of a comparison operation
type Dense = DenseTensor<FD, FS, D, T, BlockListSparse<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>>
type Dense = DenseTensor<FD, FS, D, T, BlockListSparse<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>>
The result of a comparison operation which can only return a dense Tensor
Element-wise equality
Element-wise greater-than
Element-wise greater-or-equal
Element-wise less-than
Element-wise less-or-equal
Element-wise not-equal
impl<FD, FS, D, T, A> TensorCompare<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorCompare<Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
The result of a comparison operation which can only return a dense Tensor
Element-wise greater-or-equal
impl<FD, FS, D, T, L, R> TensorDualIO<D, SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
L: SparseWrite<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, L, R> TensorDualIO<D, SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
L: SparseWrite<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type Txn = T
type Txn = T
The type of Transaction
to expect
impl<FD, FS, D, T, A> TensorDualIO<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseWrite<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorDualIO<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseWrite<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type Txn = T
type Txn = T
The type of Transaction
to expect
impl<FD, FS, D, T, A> TensorIO<D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseWrite<FD, FS, D, T>,
impl<FD, FS, D, T, A> TensorIO<D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseWrite<FD, FS, D, T>,
type Dense = DenseTensor<FD, FS, D, T, BlockListSparse<FD, FS, D, T, A>>
type Dense = DenseTensor<FD, FS, D, T, BlockListSparse<FD, FS, D, T, A>>
A dense representation of this Tensor
Return a dense representation of this Tensor
.
Return a sparse representation of this Tensor
.
impl<FD, FS, D, T, L, R> TensorMath<D, SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
L: SparseAccess<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
impl<FD, FS, D, T, L, R> TensorMath<D, SparseTensor<FD, FS, D, T, R>> for SparseTensor<FD, FS, D, T, L> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
L: SparseAccess<FD, FS, D, T>,
R: SparseAccess<FD, FS, D, T>,
type Combine = SparseTensor<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>
type Combine = SparseTensor<FD, FS, D, T, SparseCombinator<FD, FS, D, T, L, R>>
The result type of a math operation
type LeftCombine = SparseTensor<FD, FS, D, T, SparseLeftCombinator<FD, FS, D, T, L, R>>
type LeftCombine = SparseTensor<FD, FS, D, T, SparseLeftCombinator<FD, FS, D, T, L, R>>
The result type of a math operation which may ignore right-hand-side values
Add two tensors together.
Divide self
by other
.
Multiply two tensors together.
Subtract other
from self
.
impl<FD, FS, D, T, A> TensorMath<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorMath<D, Tensor<FD, FS, D, T>> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type LeftCombine = Tensor<FD, FS, D, T>
type LeftCombine = Tensor<FD, FS, D, T>
The result type of a math operation which may ignore right-hand-side values
Multiply two tensors together.
impl<FD, FS, D, T, A> TensorReduce<D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Self: TensorInstance,
<Self as TensorInstance>::Dense: TensorReduce<D, Txn = T> + Send + Sync,
impl<FD, FS, D, T, A> TensorReduce<D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node> + TryFrom<D::File, Error = TCError>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
Self: TensorInstance,
<Self as TensorInstance>::Dense: TensorReduce<D, Txn = T> + Send + Sync,
type Txn = T
type Txn = T
The type of Transaction
to expect
type Reduce = SparseTensor<FD, FS, D, T, SparseReduce<FD, FS, D, T>>
type Reduce = SparseTensor<FD, FS, D, T, SparseReduce<FD, FS, D, T>>
The result type of a reduce operation
Return the product of this Tensor
along the given axis
.
Return the product of all elements in this Tensor
.
Return the sum of this Tensor
along the given axis
.
Return the sum of all elements in this Tensor
.
impl<FD, FS, D, T, A> TensorTransform for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
impl<FD, FS, D, T, A> TensorTransform for SparseTensor<FD, FS, D, T, A> where
FD: File<Array> + TryFrom<D::File, Error = TCError>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
D::FileClass: From<TensorType>,
type Broadcast = SparseTensor<FD, FS, D, T, SparseBroadcast<FD, FS, D, T, A>>
type Broadcast = SparseTensor<FD, FS, D, T, SparseBroadcast<FD, FS, D, T, A>>
A broadcast Tensor
type Cast = SparseTensor<FD, FS, D, T, SparseCast<FD, FS, D, T, A>>
type Cast = SparseTensor<FD, FS, D, T, SparseCast<FD, FS, D, T, A>>
A type-cast Tensor
type Expand = SparseTensor<FD, FS, D, T, SparseExpand<FD, FS, D, T, A>>
type Expand = SparseTensor<FD, FS, D, T, SparseExpand<FD, FS, D, T, A>>
A Tensor
with an expanded dimension
type Slice = SparseTensor<FD, FS, D, T, A::Slice>
type Slice = SparseTensor<FD, FS, D, T, A::Slice>
A Tensor
slice
type Transpose = SparseTensor<FD, FS, D, T, A::Transpose>
type Transpose = SparseTensor<FD, FS, D, T, A::Transpose>
A transposed Tensor
Broadcast this Tensor
to the given shape
.
Cast this Tensor
to the given dtype
.
Insert a new dimension of size 1 at the given axis
.
Return a slice of this Tensor
with the given bounds
.
impl<FD, FS, D, T, A> TensorUnary<D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
impl<FD, FS, D, T, A> TensorUnary<D> for SparseTensor<FD, FS, D, T, A> where
FD: File<Array>,
FS: File<Node>,
D: Dir,
T: Transaction<D>,
A: SparseAccess<FD, FS, D, T>,
type Txn = T
type Txn = T
The type of Transaction
to expect
type Unary = SparseTensor<FD, FS, D, T, SparseUnary<FD, FS, D, T>>
type Unary = SparseTensor<FD, FS, D, T, SparseUnary<FD, FS, D, T>>
The return type of a unary operation
Return true
if all elements in this Tensor
are nonzero.
Return true
if any element in this Tensor
is nonzero.
impl<FD, FS, D, T> Transact for SparseTensor<FD, FS, D, T, SparseTable<FD, FS, D, T>> where
Self: Send + Sync,
SparseTable<FD, FS, D, T>: Transact + Send + Sync,
impl<FD, FS, D, T> Transact for SparseTensor<FD, FS, D, T, SparseTable<FD, FS, D, T>> where
Self: Send + Sync,
SparseTable<FD, FS, D, T>: Transact + Send + Sync,
Commit this transaction.
Auto Trait Implementations
impl<FD, FS, D, T, A> RefUnwindSafe for SparseTensor<FD, FS, D, T, A> where
A: RefUnwindSafe,
D: RefUnwindSafe,
FD: RefUnwindSafe,
FS: RefUnwindSafe,
T: RefUnwindSafe,
impl<FD, FS, D, T, A> Send for SparseTensor<FD, FS, D, T, A> where
A: Send,
D: Send,
FD: Send,
FS: Send,
T: Send,
impl<FD, FS, D, T, A> Sync for SparseTensor<FD, FS, D, T, A> where
A: Sync,
D: Sync,
FD: Sync,
FS: Sync,
T: Sync,
impl<FD, FS, D, T, A> Unpin for SparseTensor<FD, FS, D, T, A> where
A: Unpin,
D: Unpin,
FD: Unpin,
FS: Unpin,
T: Unpin,
impl<FD, FS, D, T, A> UnwindSafe for SparseTensor<FD, FS, D, T, A> where
A: UnwindSafe,
D: UnwindSafe,
FD: UnwindSafe,
FS: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns true
if self
can be cast into the target type T
.
Test if value
can be cast into Self
.
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
Test if self
can be cast into T
.
Returns Some(T)
if self
can be cast into T
, otherwise None
.
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.