Cyclops Tensor Framework
parallel arithmetic on multidimensional arrays
|
a sparse subset of a tensor More...
#include <sparse_tensor.h>
Public Member Functions | |
Sparse_Tensor () | |
base constructor More... | |
Sparse_Tensor (std::vector< int64_t > indices, Tensor< dtype > *parent) | |
initialize a tensor which corresponds to a set of indices More... | |
Sparse_Tensor (int64_t n, int64_t *indices, Tensor< dtype > *parent) | |
initialize a tensor which corresponds to a set of indices More... | |
void | write (dtype alpha, dtype *values, dtype beta) |
set the sparse set of indices on the parent tensor to values forall(j) i = indices[j]; parent[i] = beta*parent[i] + alpha*values[j]; More... | |
void | operator= (std::vector< dtype > values) |
void | operator+= (std::vector< dtype > values) |
void | operator-= (std::vector< dtype > values) |
void | operator= (dtype *values) |
void | operator+= (dtype *values) |
void | operator-= (dtype *values) |
void | read (dtype alpha, dtype *values, dtype beta) |
read the sparse set of indices on the parent tensor to values forall(j) i = indices[j]; values[j] = alpha*parent[i] + beta*values[j]; More... | |
operator std::vector< dtype > () | |
operator dtype * () | |
Data Fields | |
Tensor< dtype > * | parent |
dense tensor whose subset this sparse tensor is of More... | |
std::vector< int64_t > | indices |
indices of the sparse elements of this tensor More... | |
dtype | scale |
scaling factor by which to scale the tensor elements More... | |
a sparse subset of a tensor
Definition at line 14 of file sparse_tensor.h.
CTF::Sparse_Tensor< dtype >::Sparse_Tensor | ( | ) |
base constructor
Definition at line 8 of file sparse_tensor.cxx.
CTF::Sparse_Tensor< dtype >::Sparse_Tensor | ( | std::vector< int64_t > | indices, |
Tensor< dtype > * | parent | ||
) |
initialize a tensor which corresponds to a set of indices
[in] | indices | a vector of global indices to tensor values |
[in] | parent | dense distributed tensor to which this sparse tensor belongs to |
Definition at line 13 of file sparse_tensor.cxx.
References ctf.core::dtype, ctf.core::scale(), and CTF_int::tensor::sr.
CTF::Sparse_Tensor< dtype >::Sparse_Tensor | ( | int64_t | n, |
int64_t * | indices, | ||
Tensor< dtype > * | parent | ||
) |
initialize a tensor which corresponds to a set of indices
[in] | n | number of values this sparse tensor will have locally |
[in] | indices | an array of global indices to tensor values |
[in] | parent | dense distributed tensor to which this sparse tensor belongs to |
Definition at line 21 of file sparse_tensor.cxx.
References ctf.core::dtype, ctf.core::scale(), and CTF_int::tensor::sr.
CTF::Sparse_Tensor< dtype >::operator dtype * | ( | ) |
Definition at line 80 of file sparse_tensor.cxx.
References ctf.core::dtype.
CTF::Sparse_Tensor< dtype >::operator std::vector< dtype > | ( | ) |
Definition at line 73 of file sparse_tensor.cxx.
void CTF::Sparse_Tensor< dtype >::operator+= | ( | std::vector< dtype > | values | ) |
Definition at line 47 of file sparse_tensor.cxx.
References ctf.core::dtype.
void CTF::Sparse_Tensor< dtype >::operator+= | ( | dtype * | values | ) |
Definition at line 52 of file sparse_tensor.cxx.
References ctf.core::dtype.
void CTF::Sparse_Tensor< dtype >::operator-= | ( | std::vector< dtype > | values | ) |
Definition at line 57 of file sparse_tensor.cxx.
References ctf.core::dtype.
void CTF::Sparse_Tensor< dtype >::operator-= | ( | dtype * | values | ) |
Definition at line 62 of file sparse_tensor.cxx.
References ctf.core::dtype.
void CTF::Sparse_Tensor< dtype >::operator= | ( | std::vector< dtype > | values | ) |
Definition at line 38 of file sparse_tensor.cxx.
References ctf.core::dtype.
void CTF::Sparse_Tensor< dtype >::operator= | ( | dtype * | values | ) |
Definition at line 42 of file sparse_tensor.cxx.
References ctf.core::dtype.
void CTF::Sparse_Tensor< dtype >::read | ( | dtype | alpha, |
dtype * | values, | ||
dtype | beta | ||
) |
read the sparse set of indices on the parent tensor to values forall(j) i = indices[j]; values[j] = alpha*parent[i] + beta*values[j];
[in] | alpha | scaling factor on parent array |
[in] | values | data, should be preallocated to the same size as the number of indices (n) |
[in] | beta | scaling factor to apply to previously existing data in values |
Definition at line 67 of file sparse_tensor.cxx.
Referenced by ctf.core.tensor::__getitem__().
void CTF::Sparse_Tensor< dtype >::write | ( | dtype | alpha, |
dtype * | values, | ||
dtype | beta | ||
) |
set the sparse set of indices on the parent tensor to values forall(j) i = indices[j]; parent[i] = beta*parent[i] + alpha*values[j];
[in] | alpha | scaling factor on values array |
[in] | values | data, should be of same size as the number of indices (n) |
[in] | beta | scaling factor to apply to previously existing data |
Definition at line 30 of file sparse_tensor.cxx.
Referenced by ctf.core.tensor::__setitem__(), and ctf.core.tensor::from_nparray().
std::vector<int64_t > CTF::Sparse_Tensor< dtype >::indices |
indices of the sparse elements of this tensor
Definition at line 19 of file sparse_tensor.h.
Tensor<dtype>* CTF::Sparse_Tensor< dtype >::parent |
dense tensor whose subset this sparse tensor is of
Definition at line 17 of file sparse_tensor.h.
dtype CTF::Sparse_Tensor< dtype >::scale |
scaling factor by which to scale the tensor elements
Definition at line 21 of file sparse_tensor.h.