MPQC  3.0.0-alpha
sc::Tensor Class Reference
Inheritance diagram for sc::Tensor:
sc::RefCount

Public Member Functions

 Tensor (std::string filename, const Ref< MemoryGrp > &mem)
 
std::string filename () const
 returns filename_
 
std::fstream * file ()
 returns MemoryGrpRegion for this tensor
 
void set_filesize (long i)
 set/get the filesize of the tensor
 
long get_filesize () const
 
void createfile ()
 create/delete the distributed file for the tensor
 
void deletefile ()
 
void input_offset (long tag, long offset)
 input for the hash table
 
void get_block (long tag, double *data)
 get a block from the distributed file (non-blocking)
 
void add_block (long tag, double *data)
 add a block to the distributed file (non-blocking); double* data will be destroyed
 
void put_block (long tag, double *data)
 put a block to the distributed file (non-blocking)
 
bool exists (long tag) const
 does this block exist?
 
bool is_this_local (long tag)
 returns if a block associated with long tag resides in a local memory or not
 
void zero ()
 initialize/clear tensors to zero
 
void assign (double a)
 assigns all values to a
 
double norm () const
 obtain the norm of a tensor
 
double ddot (Ref< Tensor > &) const
 obtain the ddot of two tensors
 
Ref< Tensorcopy () const
 return a copy of self
 
Ref< Tensorclone () const
 return a tensor that have the same hashtable, and is intilaized to zero
 
void daxpy (const Ref< Tensor > &, double)
 perform daxpy of tensors (self+=a*other)
 
void scale (double a)
 scale self by a
 
void sync () const
 sync
 
void print (const std::string &label, std::ostream &os=ExEnv::out0()) const
 print
 
- Public Member Functions inherited from sc::RefCount
size_t identifier () const
 Return the unique identifier for this object that can be compared for different objects of different types. More...
 
int lock_ptr () const
 Lock this object.
 
int unlock_ptr () const
 Unlock this object.
 
void use_locks (bool inVal)
 start and stop using locks on this object
 
refcount_t nreference () const
 Return the reference count.
 
refcount_t reference ()
 Increment the reference count and return the new count.
 
refcount_t dereference ()
 Decrement the reference count and return the new count.
 
int managed () const
 
void unmanage ()
 Turn off the reference counting mechanism for this object. More...
 

Protected Member Functions

std::vector< long > determine_filesizes ()
 determines the distribution of blocks to nodes
 
- Protected Member Functions inherited from sc::RefCount
 RefCount (const RefCount &)
 
RefCountoperator= (const RefCount &)
 

Protected Attributes

const Ref< MemoryGrp > & mem_
 
std::string filename_
 for use in disk-based algorithm
 
std::map< long, long > hash_table_
 hash table: hash_table_.insert(key,offset)
 
long filesize_
 tensor size in double
 
std::fstream * file_
 data area
 
bool file_allocated_
 

The documentation for this class was generated from the following file:

Generated at Sun Jan 26 2020 23:24:13 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.8.16.