Psi4
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
psi::DiskTensor Class Reference

#include <thce.h>

Inheritance diagram for psi::DiskTensor:
psi::Tensor

Public Member Functions

 DiskTensor (const std::string &name, std::vector< std::string > &dimensions, std::vector< int > &sizes, bool save=false, bool load=false)
 
virtual ~DiskTensor ()
 Master destructor. More...
 
virtual bool core () const
 Is this a core tensor? More...
 
virtual bool disk () const
 Is this a disk tensor? More...
 
virtual bool trust () const
 Is this a trust core tensor? More...
 
virtual bool swapped () const
 Is this a swapped-out core tensor? More...
 
virtual void swap_check () const
 Throw an exception if the tensor is swapped out or disk based. More...
 
virtual size_t core_doubles () const
 How many core doubles are currently allocated by this tensor? More...
 
virtual size_t disk_doubles () const
 How many disk doubles are currently allocated by this tensor? More...
 
virtual void print (std::string fh="outfile", int level=2) const
 Print the available tensor data. More...
 
virtual FILE * file_pointer ()
 File underlying this Tensor. More...
 
virtual void set_save (bool save)
 Set save flag for disk resuse. More...
 
virtual void zero ()
 Zero the tensor out and prestripe. More...
 
- Public Member Functions inherited from psi::Tensor
 Tensor (const std::string &name, std::vector< std::string > &dimensions, std::vector< int > &sizes)
 Master constructor. More...
 
virtual ~Tensor ()
 Master destructor. More...
 
std::string name () const
 Name of this Tensor. More...
 
std::string filename () const
 Unique filename of this Tensor. More...
 
size_t numel () const
 Total number of elements in this Tensor. More...
 
int order () const
 Order (number of dimensions) in this Tensor. More...
 
std::vector< std::string > & dimensions ()
 Classes of dimensions. More...
 
std::vector< int > & sizes ()
 Allocated sizes of dimensions. More...
 
std::vector< int > & active_sizes ()
 Active sizes of dimensions. More...
 
void print_header (std::string fh="outfile") const
 Print only name and sizing data. More...
 
virtual void slice (std::shared_ptr< Tensor > A, std::vector< std::tuple< bool, int, int, bool, int, int > > &topology)
 
virtual double * pointer () const
 Access the data pointer. More...
 
virtual void swap_out (bool changed=true)
 Swap this tensor out to disk (does not write if existing disk mirror and not changed) More...
 
virtual void swap_in (bool read=true)
 Swap this tensor in to core (explicitly reads if true) More...
 
virtual void scale (double val)
 Scale the tensor by val (ignores active dims) More...
 
virtual void set_data (double *data)
 Copy contents of data (ignores active dims) More...
 
virtual void set_pointer (double *data)
 Update the trust pointer to data (throws if not trust) More...
 
virtual void add (std::shared_ptr< Tensor > A, double alpha=1.0, double beta=0.0)
 Direct elementwise generalized DAXPY: C = alpha * A + beta * C (ignores active dims) More...
 
virtual void permute (std::shared_ptr< Tensor > A, std::vector< int > &topology)
 
virtual void contract (std::shared_ptr< Tensor > A, std::shared_ptr< Tensor > B, std::vector< std::tuple< std::string, int, int, int > > &topology, double alpha=1.0, double beta=0.0)
 

Static Public Member Functions

static std::shared_ptr< Tensorbuild (const std::string &name, bool save=false, bool load=false)
 Order-0 Constructor. More...
 
static std::shared_ptr< Tensorbuild (const std::string &name, const std::string &dimension1, int size1, bool save=false, bool load=false)
 Order-1 Constructor. More...
 
static std::shared_ptr< Tensorbuild (const std::string &name, const std::string &dimension1, int size1, const std::string &dimension2, int size2, bool save=false, bool load=false)
 Order-2 Constructor. More...
 
static std::shared_ptr< Tensorbuild (const std::string &name, const std::string &dimension1, int size1, const std::string &dimension2, int size2, const std::string &dimension3, int size3, bool save=false, bool load=false)
 Order-3 Constructor. More...
 
static std::shared_ptr< Tensorbuild (const std::string &name, const std::string &dimension1, int size1, const std::string &dimension2, int size2, const std::string &dimension3, int size3, const std::string &dimension4, int size4, bool save=false, bool load=false)
 Order-4 Constructor. More...
 

Protected Attributes

bool save_
 Save file upon destruct? More...
 
FILE * fh_
 File pointer. More...
 
- Protected Attributes inherited from psi::Tensor
std::string name_
 Name of this Tensor. More...
 
std::string filename_
 Unique filename to prevent disk clash. More...
 
size_t numel_
 Total number of elements in this Tensor. More...
 
int order_
 Order (number of dimensions) in this Tensor. More...
 
std::vector< std::string > dimensions_
 Classes of dimensions. More...
 
std::vector< int > sizes_
 Sizes of dimensions (lda-style) More...
 
std::vector< int > active_sizes_
 Active sizes of dimensions (gimp-style) More...
 

Additional Inherited Members

- Protected Member Functions inherited from psi::Tensor
void set_filename ()
 Set the filename to scratch, PID, namespace, unique ID, name. More...
 

Detailed Description

Class DiskTensor provides functionality for the creation and manipulation of Tensor objects in scratch disk space

Constructor & Destructor Documentation

psi::DiskTensor::DiskTensor ( const std::string &  name,
std::vector< std::string > &  dimensions,
std::vector< int > &  sizes,
bool  save = false,
bool  load = false 
)

Master constructor Will create new file (w+) if load Will open existing file (r+) if !load Will save file upon destruct if save Will delete file upon destruct if !save Does not explicitly prestripe, call zero to accomplish this

psi::DiskTensor::~DiskTensor ( )
virtual

Master destructor.

Member Function Documentation

std::shared_ptr< Tensor > psi::DiskTensor::build ( const std::string &  name,
bool  save = false,
bool  load = false 
)
static

Order-0 Constructor.

std::shared_ptr< Tensor > psi::DiskTensor::build ( const std::string &  name,
const std::string &  dimension1,
int  size1,
bool  save = false,
bool  load = false 
)
static

Order-1 Constructor.

std::shared_ptr< Tensor > psi::DiskTensor::build ( const std::string &  name,
const std::string &  dimension1,
int  size1,
const std::string &  dimension2,
int  size2,
bool  save = false,
bool  load = false 
)
static

Order-2 Constructor.

std::shared_ptr< Tensor > psi::DiskTensor::build ( const std::string &  name,
const std::string &  dimension1,
int  size1,
const std::string &  dimension2,
int  size2,
const std::string &  dimension3,
int  size3,
bool  save = false,
bool  load = false 
)
static

Order-3 Constructor.

std::shared_ptr< Tensor > psi::DiskTensor::build ( const std::string &  name,
const std::string &  dimension1,
int  size1,
const std::string &  dimension2,
int  size2,
const std::string &  dimension3,
int  size3,
const std::string &  dimension4,
int  size4,
bool  save = false,
bool  load = false 
)
static

Order-4 Constructor.

virtual bool psi::DiskTensor::core ( ) const
inlinevirtual

Is this a core tensor?

Implements psi::Tensor.

virtual size_t psi::DiskTensor::core_doubles ( ) const
inlinevirtual

How many core doubles are currently allocated by this tensor?

Implements psi::Tensor.

virtual bool psi::DiskTensor::disk ( ) const
inlinevirtual

Is this a disk tensor?

Implements psi::Tensor.

virtual size_t psi::DiskTensor::disk_doubles ( ) const
inlinevirtual

How many disk doubles are currently allocated by this tensor?

Implements psi::Tensor.

virtual FILE* psi::DiskTensor::file_pointer ( )
inlinevirtual

File underlying this Tensor.

Reimplemented from psi::Tensor.

void psi::DiskTensor::print ( std::string  fh = "outfile",
int  level = 2 
) const
virtual

Print the available tensor data.

Implements psi::Tensor.

virtual void psi::DiskTensor::set_save ( bool  save)
inlinevirtual

Set save flag for disk resuse.

Reimplemented from psi::Tensor.

void psi::DiskTensor::swap_check ( ) const
virtual

Throw an exception if the tensor is swapped out or disk based.

Implements psi::Tensor.

virtual bool psi::DiskTensor::swapped ( ) const
inlinevirtual

Is this a swapped-out core tensor?

Implements psi::Tensor.

virtual bool psi::DiskTensor::trust ( ) const
inlinevirtual

Is this a trust core tensor?

Implements psi::Tensor.

void psi::DiskTensor::zero ( void  )
virtual

Zero the tensor out and prestripe.

Implements psi::Tensor.

Member Data Documentation

FILE* psi::DiskTensor::fh_
protected

File pointer.

bool psi::DiskTensor::save_
protected

Save file upon destruct?


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