SparseLibrary  Version 1.6.0
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
HilbertTriplet< T > Class Template Reference

Hilbert-coordinate-aware triplet. More...

#include <HilbertTriplet.hpp>

Collaboration diagram for HilbertTriplet< T >:
Collaboration graph
[legend]

Public Member Functions

unsigned long int i () const
 
unsigned long int j () const
 
 HilbertTriplet (unsigned long int i, unsigned long int j, T val)
 Base constructor. More...
 
 HilbertTriplet ()
 Base constructor. More...
 
void calculateHilbertCoordinate ()
 Calculates the full Hilbert coordinate.
 
void getHilbertCoordinate (size_t &h1, size_t &h2)
 Gets the Hilbert coordinates. More...
 
size_t getMostSignificantHilbertBits ()
 
size_t getLeastSignificantHilbertBits ()
 

Static Public Member Functions

static void save (std::string fn, HilbertTriplet< T > *toWrite, const unsigned long int m, const unsigned long int n, const size_t s)
 Saves an array of Hilbert triplets to a file, in binary format. More...
 
static void save (std::string fn, std::vector< HilbertTriplet< T > > &toWrite, const unsigned long int m, const unsigned long int n)
 Saves a std::vector of Hilbert triplets to a file, in binary format. More...
 

Public Attributes

value
 Value stored at this triplet. More...
 

Protected Attributes

size_t row
 The row coordinate of this triplet. More...
 
size_t column
 The column coordinate of this triplet. More...
 
size_t hilbert1
 Most significant part of a 128-bits Hilbert coordinate, for one-shot, non-iterative, calculation. More...
 
size_t hilbert2
 Least significant part of a 128-bits Hilbert coordinate, for one-shot, non-iterative, calculation. More...
 

Detailed Description

template<typename T>
class HilbertTriplet< T >

Hilbert-coordinate-aware triplet.

Can save vectors of HilbertTriplets to binary.

Constructor & Destructor Documentation

template<typename T>
HilbertTriplet< T >::HilbertTriplet ( unsigned long int  i,
unsigned long int  j,
val 
)
inline

Base constructor.

Parameters
irow index.
jcolumn index.
valnonzero value.
template<typename T>
HilbertTriplet< T >::HilbertTriplet ( )
inline

Base constructor.

Sets all values to zero.

Member Function Documentation

template<typename T>
void HilbertTriplet< T >::getHilbertCoordinate ( size_t &  h1,
size_t &  h2 
)
inline

Gets the Hilbert coordinates.

Does not check if calculateHilbertCoordinate() was called first, otherwise (0,0) will be returned. Note that the Hilbert coordinate is a 1D 128-bits unsigned integer.

Parameters
h1The first (most significant) 64-bits of the Hilbert coordinate
h2the remainder of the Hilbert coordinate.

References HilbertTriplet< T >::hilbert1, and HilbertTriplet< T >::hilbert2.

template<typename T>
size_t HilbertTriplet< T >::getLeastSignificantHilbertBits ( )
inline
template<typename T>
size_t HilbertTriplet< T >::getMostSignificantHilbertBits ( )
inline
template<typename T>
unsigned long int HilbertTriplet< T >::i ( ) const
inline
Returns
Row index of this triplet.

References HilbertTriplet< T >::row.

Referenced by HTS< T >::cmp(), and HilbertTriplet< T >::save().

template<typename T>
unsigned long int HilbertTriplet< T >::j ( ) const
inline
Returns
Column index of this triplet.

References HilbertTriplet< T >::column.

Referenced by HTS< T >::cmp(), and HilbertTriplet< T >::save().

template<typename T>
static void HilbertTriplet< T >::save ( std::string  fn,
HilbertTriplet< T > *  toWrite,
const unsigned long int  m,
const unsigned long int  n,
const size_t  s 
)
inlinestatic

Saves an array of Hilbert triplets to a file, in binary format.

Does NOT save the Hilbert coordinate! (For reading-in the written file, use the regular Triplet scheme)

Parameters
fnFilename to save to (overwrite mode).
toWriteArray of Hilbert triplets to write.
mTotal number of rows in the matrix.
nTotal number of columns in the matrix.
sSize of the array toWrite.

References HilbertTriplet< T >::i(), HilbertTriplet< T >::j(), and HilbertTriplet< T >::value.

Referenced by HilbertTriplet< T >::save(), Hilbert< T >::saveBinary(), and HTS< T >::saveBinary().

template<typename T>
static void HilbertTriplet< T >::save ( std::string  fn,
std::vector< HilbertTriplet< T > > &  toWrite,
const unsigned long int  m,
const unsigned long int  n 
)
inlinestatic

Saves a std::vector of Hilbert triplets to a file, in binary format.

Does NOT save the Hilbert coordinate! (For reading-in the written file, use the regular Triplet scheme)

Parameters
fnFilename to save to (overwrite mode).
toWriteVector of Hilbert triplets to write.
mTotal number of rows in the matrix.
nTotal number of columns in the matrix.

References HilbertTriplet< T >::save().

Member Data Documentation

template<typename T>
size_t HilbertTriplet< T >::column
protected

The column coordinate of this triplet.

Referenced by HilbertTriplet< T >::calculateHilbertCoordinate(), and HilbertTriplet< T >::j().

template<typename T>
size_t HilbertTriplet< T >::hilbert1
protected

Most significant part of a 128-bits Hilbert coordinate, for one-shot, non-iterative, calculation.

Referenced by HilbertTriplet< T >::calculateHilbertCoordinate(), HilbertTriplet< T >::getHilbertCoordinate(), and HilbertTriplet< T >::getMostSignificantHilbertBits().

template<typename T>
size_t HilbertTriplet< T >::hilbert2
protected

Least significant part of a 128-bits Hilbert coordinate, for one-shot, non-iterative, calculation.

Referenced by HilbertTriplet< T >::calculateHilbertCoordinate(), HilbertTriplet< T >::getHilbertCoordinate(), and HilbertTriplet< T >::getLeastSignificantHilbertBits().

template<typename T>
size_t HilbertTriplet< T >::row
protected

The row coordinate of this triplet.

Referenced by HilbertTriplet< T >::calculateHilbertCoordinate(), and HilbertTriplet< T >::i().

template<typename T>
T HilbertTriplet< T >::value

Value stored at this triplet.

Referenced by HilbertTriplet< T >::save().


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