Struct tc_tensor::BlockListFile
source · pub struct BlockListFile<FD, FS, D, T> { /* private fields */ }
Expand description
A wrapper around a DenseTensor
File
Implementations§
source§impl<FD, FS, D, T> BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
impl<FD, FS, D, T> BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
sourcepub fn constant(
file: FD,
txn_id: TxnId,
shape: Shape,
value: Number
) -> TCResult<Self>
pub fn constant(
file: FD,
txn_id: TxnId,
shape: Shape,
value: Number
) -> TCResult<Self>
Construct a new BlockListFile
with the given Shape
, filled with the given value
.
sourcepub async fn random_normal(
file: FD,
txn_id: TxnId,
shape: Shape,
dtype: FloatType,
mean: Float,
std: Float
) -> TCResult<Self>
pub async fn random_normal(
file: FD,
txn_id: TxnId,
shape: Shape,
dtype: FloatType,
mean: Float,
std: Float
) -> TCResult<Self>
Construct a new BlockListFile
with the given Shape
, with a random normal distribution.
sourcepub fn random_uniform(
file: FD,
txn_id: TxnId,
shape: Shape,
dtype: FloatType
) -> TCResult<Self>
pub fn random_uniform(
file: FD,
txn_id: TxnId,
shape: Shape,
dtype: FloatType
) -> TCResult<Self>
Construct a new BlockListFile
with the given Shape
, with a random normal distribution.
sourcepub async fn from_blocks<S: Stream<Item = TCResult<Array>> + Send + Unpin>(
file: FD,
txn_id: TxnId,
shape: Option<Shape>,
dtype: NumberType,
blocks: S
) -> TCResult<Self>
pub async fn from_blocks<S: Stream<Item = TCResult<Array>> + Send + Unpin>(
file: FD,
txn_id: TxnId,
shape: Option<Shape>,
dtype: NumberType,
blocks: S
) -> TCResult<Self>
Construct a new BlockListFile
from the given Stream
of Array
blocks.
sourcepub async fn from_values<S: Stream<Item = TCResult<Number>> + Send + Unpin>(
file: FD,
txn_id: TxnId,
shape: Shape,
dtype: NumberType,
values: S
) -> TCResult<Self>
pub async fn from_values<S: Stream<Item = TCResult<Number>> + Send + Unpin>(
file: FD,
txn_id: TxnId,
shape: Shape,
dtype: NumberType,
values: S
) -> TCResult<Self>
Construct a new BlockListFile
from the given Stream
of elements.
sourcepub async fn range(
file: FD,
txn_id: TxnId,
shape: Shape,
start: Number,
stop: Number
) -> TCResult<Self>
pub async fn range(
file: FD,
txn_id: TxnId,
shape: Shape,
start: Number,
stop: Number
) -> TCResult<Self>
Construct a new BlockListFile
of elements evenly distributed between start
and stop
.
sourcepub async fn merge_sort(&self, txn_id: TxnId) -> TCResult<()>
pub async fn merge_sort(&self, txn_id: TxnId) -> TCResult<()>
Sort the elements in this BlockListFile
.
Trait Implementations§
source§impl<FD: Clone, FS: Clone, D: Clone, T: Clone> Clone for BlockListFile<FD, FS, D, T>
impl<FD: Clone, FS: Clone, D: Clone, T: Clone> Clone for BlockListFile<FD, FS, D, T>
source§fn clone(&self) -> BlockListFile<FD, FS, D, T>
fn clone(&self) -> BlockListFile<FD, FS, D, T>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<FD, FS, D, T, B> CopyFrom<D, B> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::Store: From<FD>,
impl<FD, FS, D, T, B> CopyFrom<D, B> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
B: DenseAccess<FD, FS, D, T>,
D::Store: From<FD>,
source§impl<FD, FS, D, T> DenseAccess<FD, FS, D, T> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Write: DirCreateFile<FD>,
impl<FD, FS, D, T> DenseAccess<FD, FS, D, T> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Write: DirCreateFile<FD>,
§type Transpose = BlockListTranspose<FD, FS, D, T, BlockListFile<FD, FS, D, T>>
type Transpose = BlockListTranspose<FD, FS, D, T, BlockListFile<FD, FS, D, T>>
The type returned by
transpose
source§fn accessor(self) -> DenseAccessor<FD, FS, D, T>
fn accessor(self) -> DenseAccessor<FD, FS, D, T>
Return a
DenseAccessor
enum which contains this accessor.source§fn block_stream<'a>(
self,
txn: T
) -> TCBoxTryFuture<'a, TCBoxTryStream<'a, Array>>
fn block_stream<'a>(
self,
txn: T
) -> TCBoxTryFuture<'a, TCBoxTryStream<'a, Array>>
Return a stream of the
Array
s which this DenseTensor
comprises.source§fn transpose(self, permutation: Option<Vec<usize>>) -> TCResult<Self::Transpose>
fn transpose(self, permutation: Option<Vec<usize>>) -> TCResult<Self::Transpose>
Return a transpose of this
DenseTensor
.source§fn read_values<'async_trait>(
self,
txn: Self::Txn,
coords: Coords
) -> Pin<Box<dyn Future<Output = TCResult<Array>> + Send + 'async_trait>>where
Self: 'async_trait,
fn read_values<'async_trait>(
self,
txn: Self::Txn,
coords: Coords
) -> Pin<Box<dyn Future<Output = TCResult<Array>> + Send + 'async_trait>>where
Self: 'async_trait,
Return an Array with the values at the given coordinates.
source§fn value_stream<'a>(
self,
txn: Self::Txn
) -> TCBoxTryFuture<'a, TCBoxTryStream<'a, Number>>
fn value_stream<'a>(
self,
txn: Self::Txn
) -> TCBoxTryFuture<'a, TCBoxTryStream<'a, Number>>
Return a stream of the elements of this
DenseTensor
.source§impl<FD, FS, D, T> DenseWrite<FD, FS, D, T> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Write: DirCreateFile<FD>,
impl<FD, FS, D, T> DenseWrite<FD, FS, D, T> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Write: DirCreateFile<FD>,
source§fn write<'life0, 'async_trait, B>(
&'life0 self,
txn: Self::Txn,
bounds: Bounds,
value: B
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
B: 'async_trait + DenseAccess<FD, FS, D, T>,
Self: 'async_trait,
'life0: 'async_trait,
fn write<'life0, 'async_trait, B>(
&'life0 self,
txn: Self::Txn,
bounds: Bounds,
value: B
) -> Pin<Box<dyn Future<Output = TCResult<()>> + Send + 'async_trait>>where
B: 'async_trait + DenseAccess<FD, FS, D, T>,
Self: 'async_trait,
'life0: 'async_trait,
Overwrite this accessor’s contents with those of the given accessor.
source§impl<FD, FS, D, T> Display for BlockListFile<FD, FS, D, T>
impl<FD, FS, D, T> Display for BlockListFile<FD, FS, D, T>
source§impl<FD, FS, D, T> From<BlockListFile<FD, FS, D, T>> for DenseAccessor<FD, FS, D, T>where
FD: File<Key = u64, Block = Array>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
impl<FD, FS, D, T> From<BlockListFile<FD, FS, D, T>> for DenseAccessor<FD, FS, D, T>where
FD: File<Key = u64, Block = Array>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
source§fn from(file: BlockListFile<FD, FS, D, T>) -> Self
fn from(file: BlockListFile<FD, FS, D, T>) -> Self
Converts to this type from the input type.
source§impl<FD, FS, D, T> FromStream for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array>,
FS: Send,
D: Send,
T: Send,
impl<FD, FS, D, T> FromStream for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array>,
FS: Send,
D: Send,
T: Send,
source§impl<FD, FS, D, T> Persist<D> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Store: From<FD>,
impl<FD, FS, D, T> Persist<D> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Store: From<FD>,
type Txn = T
type Schema = Schema
source§fn create(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
fn create(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
Create a new instance of
Self
from an empty Store
.source§fn load(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
fn load(txn_id: TxnId, schema: Self::Schema, store: D::Store) -> TCResult<Self>
Load a saved instance of
Self
from persistent storage.
Should only be invoked at startup time.source§impl<FD, FS, D, T> Restore<D> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Store: From<FD>,
impl<FD, FS, D, T> Restore<D> for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array, Inner = D::Inner> + TryFrom<D::Store, Error = TCError>,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
D::Store: From<FD>,
source§impl<FD, FS, D, T> TensorAccess for BlockListFile<FD, FS, D, T>
impl<FD, FS, D, T> TensorAccess for BlockListFile<FD, FS, D, T>
source§impl<FD, FS, D, T> Transact for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array> + Transact,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
impl<FD, FS, D, T> Transact for BlockListFile<FD, FS, D, T>where
FD: File<Key = u64, Block = Array> + Transact,
FS: File<Key = NodeId, Block = Node>,
D: Dir,
T: Transaction<D>,
source§fn commit<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = Self::Commit> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn commit<'life0, 'async_trait>(
&'life0 self,
txn_id: TxnId
) -> Pin<Box<dyn Future<Output = Self::Commit> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Commit this transaction.
Auto Trait Implementations§
impl<FD, FS, D, T> RefUnwindSafe for BlockListFile<FD, FS, D, T>where
D: RefUnwindSafe,
FD: RefUnwindSafe,
FS: RefUnwindSafe,
T: RefUnwindSafe,
impl<FD, FS, D, T> Send for BlockListFile<FD, FS, D, T>where
D: Send,
FD: Send,
FS: Send,
T: Send,
impl<FD, FS, D, T> Sync for BlockListFile<FD, FS, D, T>where
D: Sync,
FD: Sync,
FS: Sync,
T: Sync,
impl<FD, FS, D, T> Unpin for BlockListFile<FD, FS, D, T>where
D: Unpin,
FD: Unpin,
FS: Unpin,
T: Unpin,
impl<FD, FS, D, T> UnwindSafe for BlockListFile<FD, FS, D, T>where
D: UnwindSafe,
FD: UnwindSafe,
FS: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
source§impl<F> Match for F
impl<F> Match for F
source§fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
fn matches<T>(&self) -> boolwhere
T: TryCastFrom<Self>,
Returns
true
if self
can be cast into the target type T
.source§impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
impl<F, T> TryCastFrom<F> for Twhere
T: CastFrom<F>,
source§fn can_cast_from(_: &F) -> bool
fn can_cast_from(_: &F) -> bool
Test if
value
can be cast into Self
.source§fn opt_cast_from(f: F) -> Option<T>
fn opt_cast_from(f: F) -> Option<T>
Returns
Some(Self)
if the source value can be cast into Self
, otherwise None
.source§impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
impl<F, T> TryCastInto<T> for Fwhere
T: TryCastFrom<F>,
source§fn can_cast_into(&self) -> bool
fn can_cast_into(&self) -> bool
Test if
self
can be cast into T
.source§fn opt_cast_into(self) -> Option<T>
fn opt_cast_into(self) -> Option<T>
Returns
Some(T)
if self
can be cast into T
, otherwise None
.