faunus
Public Member Functions | List of all members
Faunus::PairMatrix< T, triangular > Class Template Reference

Container for data between pairs. More...

#include <pairmatrix.h>

Public Member Functions

void resize (size_t n)
 
 PairMatrix (size_t n=0, T val=T())
 
auto size () const
 
const Toperator() (size_t i, size_t j) const
 
void set (size_t i, size_t j, T val)
 
void set (T val)
 Set a uniform value.
 
void setZero ()
 

Detailed Description

template<class T, bool triangular = false>
class Faunus::PairMatrix< T, triangular >

Container for data between pairs.

Symmetric, dynamic NxN matrix for storing data about pairs. Set values with set(). If triangular==true the memory usage is reduced but introduces an if-statement upon access.

int i=2,j=3; // particle type, for example
PairMatrix<double> m;
m.set(i,j,12.0);
cout << m(i,j); // -> 12.0
cout << m(i,j)==m(j,i); // -> true
Note
Vector of vector does not allocate contiguous memory

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