28 #ifndef _chemistry_qc_ccr12_tensor_h
29 #define _chemistry_qc_ccr12_tensor_h
33 #include <util/misc/compute.h>
34 #include <util/group/memory.h>
35 #include <util/group/memregion.h>
36 #include <util/group/message.h>
37 #include <util/group/thread.h>
38 #include <math/distarray4/distarray4.h>
41 #define DISK_BASED_SMITH
43 #ifdef DISK_BASED_SMITH
63 #ifndef DISK_BASED_SMITH
81 #ifndef DISK_BASED_SMITH
89 long get_filesize()
const {
return filesize_;};
105 bool exists(
long tag)
const;
119 double ddot(Ref<Tensor>&)
const;
122 Ref<Tensor>
copy()
const;
125 Ref<Tensor>
clone()
const;
128 void daxpy(
const Ref<Tensor>&,
double);
131 void scale(
double a);
134 #ifndef DISK_BASED_SMITH
135 void sync()
const { const_cast<MemoryGrpRegion*>(
file_)->sync();};
141 void print(
const std::string& label, std::ostream& os =
ExEnv::out0())
const;
147 double RMS(
const Tensor& t);
void assign(double a)
assigns all values to a
void add_block(long tag, double *data)
add a block to the distributed file (non-blocking); double* data will be destroyed
bool exists(long tag) const
does this block exist?
void get_block(long tag, double *data)
get a block from the distributed file (non-blocking)
void sync() const
sync
Definition: tensor.h:137
double ddot(Ref< Tensor > &) const
obtain the ddot of two tensors
std::string filename_
for use in disk-based algorithm
Definition: tensor.h:54
std::vector< long > determine_filesizes()
determines the distribution of blocks to nodes
void zero()
initialize/clear tensors to zero
A template class that maintains references counts.
Definition: ref.h:361
long filesize_
tensor size in double
Definition: tensor.h:60
std::string filename() const
returns filename_
Definition: tensor.h:78
void scale(double a)
scale self by a
void input_offset(long tag, long offset)
input for the hash table
Ref< Tensor > clone() const
return a tensor that have the same hashtable, and is intilaized to zero
void set_filesize(long i)
set/get the filesize of the tensor
std::map< long, long > hash_table_
hash table: hash_table_.insert(key,offset)
Definition: tensor.h:57
std::fstream * file_
data area
Definition: tensor.h:66
double RMS(const Tensor &t)
Computes the `‘RMS norm’' of the tensor, defined as tensor->norm() divided by the size of the tensor.
double norm() const
obtain the norm of a tensor
void print(const std::string &label, std::ostream &os=ExEnv::out0()) const
print
void put_block(long tag, double *data)
put a block to the distributed file (non-blocking)
bool is_this_local(long tag)
returns if a block associated with long tag resides in a local memory or not
std::fstream * file()
returns MemoryGrpRegion for this tensor
Definition: tensor.h:84
static std::ostream & out0()
Return an ostream that writes from node 0.
void createfile()
create/delete the distributed file for the tensor
void daxpy(const Ref< Tensor > &, double)
perform daxpy of tensors (self+=a*other)
The base class for all reference counted objects.
Definition: ref.h:192
Ref< Tensor > copy() const
return a copy of self
The MemoryGrpRegion is a MemoryGrp proxy to a region of a MemoryGrp.
Definition: memregion.h:46
Contains all MPQC code up to version 3.
Definition: mpqcin.h:14
Generated at Sun Jan 26 2020 23:23:57 for MPQC
3.0.0-alpha using the documentation package Doxygen
1.8.16.