Tensor

Struct Tensor 

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

Intended to be generic over various arthimetic types, currently only support f64. Tensor are contructed using either dense or sparse representations. In addition to the represenetation, a tensor also has a shape, which is a list of indices that define the dimensions of the tensor. Tensor data can be loaded from a file, can be filled with a constant value, or can be randomly initialized. Note that the eDSL is not pure rust, so this documentation serves to capture the functionality as best as possible with in the bounds of the Rust language

Implementations§

Source§

impl<T: Default> Tensor<T>

Source

pub fn dense(_index_list: &[Index]) -> Tensor<T>

creates a dense representation of a tensor with shape defined by the array of indicies

Source

pub fn csr(_index_list: &[Index]) -> Tensor<T>

creates a csr representation of a tensor with shape defined by the array of indicies

Source

pub fn dcsr(_index_list: &[Index]) -> Tensor<T>

creates a dcsr representation of a tensor with shape defined by the array of indicies

Source

pub fn coo(_index_list: &[Index]) -> Tensor<T>

creates a coo representation of a tensor with shape defined by the array of indicies

Source

pub fn csf(_index_list: &[Index]) -> Tensor<T>

creates a csf representation of a tensor with shape defined by the array of indicies

Source

pub fn fill(&mut self, _val: T)

populate a tensor with a constant value. Currently only valid for dense tensors

Source

pub fn fill_from_file(&mut self, _filename: &str)

load a tensor from a file. Currently only valid for sparse tensors

Source

pub fn random(&mut self)

randomly initialize a tensor. Currently only valid for dense tensors

Source

pub fn transpose(&self) -> Tensor<T>

return the transpose of the tensor

Source

pub fn sum(&self) -> T

return the sum of the tensor

Auto Trait Implementations§

§

impl<T> Freeze for Tensor<T>

§

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

§

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

§

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

§

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

§

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