OpenFPM_pdata  4.1.0
Project that contain the implementation of distributed structures
 
Loading...
Searching...
No Matches
comb< dim > Struct Template Reference

Position of the element of dimension d in the hyper-cube of dimension dim. More...

Detailed Description

template<unsigned int dim>
struct comb< dim >

Position of the element of dimension d in the hyper-cube of dimension dim.

These objects are returned by the Hyper-cube static functions The number of non-zero d define the dimensionality of the object ( +1 or -1 its position in the hypercube)

Example

                         (0,1)
            (-1,1)  +---------+ (1,1)
                    |         |
                    |         |
              (-1,0)|  (0,0)  | (1,0)
                    |         |
                    |         |
            (-1,-1) +---------+ (1,-1)
                       (0,-1)
Template Parameters
dimof the hyper-cube

Definition at line 34 of file comb.hpp.

#include <comb.hpp>

Public Member Functions

bool isValid ()
 check if it is a valid combination
 
bool isSub (comb< dim > cmb)
 Check if the combination is a sub-element.
 
void zero ()
 Set all the elements to zero.
 
void mone ()
 Set all the elements to -1.
 
comb< dim > operator& (signed char c_)
 Bitwise operator &.
 
void sign_flip ()
 Flip the sign of the combination.
 
comb< dim > operator- (const comb< dim > &t)
 Subtract the combinations and return the result.
 
comb< dim > flip ()
 flip the coefficent of the combination to be < 0
 
comb< dim > operator- ()
 Subtract the combinations and return the result.
 
comb< dim > operator+ (const comb< dim > &t)
 sum the combinations and return the result
 
bool operator!= (const comb< dim > &t) const
 Compare two combination.
 
bool operator== (const comb< dim > &t) const
 Compare two combination.
 
signed char operator[] (int i) const
 Get the i combination coefficient.
 
signed char * getComb ()
 get the combination array pointer
 
const signed char * getComb () const
 get the combination array pointer
 
signed char value (int i) const
 get the index i of the combination
 
int n_zero () const
 
 comb ()
 Default constructor.
 
 comb (std::initializer_list< signed char > c)
 Constructor from a list of numbers.
 
bool isNegative ()
 Check if any alement in the combination is <= 0.
 
std::string to_string () const
 Convert a combination into string.
 
size_t lin () const
 Linearization.
 

Data Fields

signed char c [dim]
 Array that store the combination.
 

Constructor & Destructor Documentation

◆ comb() [1/2]

template<unsigned int dim>
comb< dim >::comb ( )
inline

Default constructor.

Definition at line 309 of file comb.hpp.

◆ comb() [2/2]

template<unsigned int dim>
comb< dim >::comb ( std::initializer_list< signed char >  c)
inline

Constructor from a list of numbers.

Parameters
clist of numbers

Definition at line 317 of file comb.hpp.

Member Function Documentation

◆ flip()

template<unsigned int dim>
comb< dim > comb< dim >::flip ( )
inline

flip the coefficent of the combination to be < 0

  • 0 --> 0
  • 1 --> -1
  • 2 --> -2
  • -1 --> -1
Returns
flipped combination

Definition at line 160 of file comb.hpp.

◆ getComb() [1/2]

template<unsigned int dim>
signed char * comb< dim >::getComb ( )
inline

get the combination array pointer

Returns
an array of char representing the combination

Definition at line 260 of file comb.hpp.

◆ getComb() [2/2]

template<unsigned int dim>
const signed char * comb< dim >::getComb ( ) const
inline

get the combination array pointer

Returns
an array of char representing the combination

Definition at line 271 of file comb.hpp.

◆ isNegative()

template<unsigned int dim>
bool comb< dim >::isNegative ( )
inline

Check if any alement in the combination is <= 0.

+-—#-—+ | | | |

*

| | | | +-—#-—+

Is negative return true when the combination indicate * the down-left vertex + and down and left edge #

Definition at line 337 of file comb.hpp.

◆ isSub()

template<unsigned int dim>
bool comb< dim >::isSub ( comb< dim >  cmb)
inline

Check if the combination is a sub-element.

Parameters
cmbcombination to check if it is sub-element
Returns
true if cmb is a sub-element of this combination

Definition at line 66 of file comb.hpp.

◆ isValid()

template<unsigned int dim>
bool comb< dim >::isValid ( )
inline

check if it is a valid combination

Returns
true if it is valid

Definition at line 45 of file comb.hpp.

◆ lin()

template<unsigned int dim>
size_t comb< dim >::lin ( ) const
inline

Linearization.

From the combination produce a number

Returns
the number

Definition at line 376 of file comb.hpp.

◆ mone()

template<unsigned int dim>
void comb< dim >::mone ( )
inline

Set all the elements to -1.

Definition at line 95 of file comb.hpp.

◆ n_zero()

template<unsigned int dim>
int comb< dim >::n_zero ( ) const
inline

Definition at line 296 of file comb.hpp.

◆ operator!=()

template<unsigned int dim>
bool comb< dim >::operator!= ( const comb< dim > &  t) const
inline

Compare two combination.

check if they match

Parameters
tcombination to check
Returns
true if the two combination match, false otherwise

Definition at line 214 of file comb.hpp.

◆ operator&()

template<unsigned int dim>
comb< dim > comb< dim >::operator& ( signed char  c_)
inline

Bitwise operator &.

Returns
Result combination

Definition at line 108 of file comb.hpp.

◆ operator+()

template<unsigned int dim>
comb< dim > comb< dim >::operator+ ( const comb< dim > &  t)
inline

sum the combinations and return the result

Returns
Result combination

Definition at line 194 of file comb.hpp.

◆ operator-() [1/2]

template<unsigned int dim>
comb< dim > comb< dim >::operator- ( )
inline

Subtract the combinations and return the result.

Returns
Result combination

Definition at line 177 of file comb.hpp.

◆ operator-() [2/2]

template<unsigned int dim>
comb< dim > comb< dim >::operator- ( const comb< dim > &  t)
inline

Subtract the combinations and return the result.

Returns
Result combination

Definition at line 137 of file comb.hpp.

◆ operator==()

template<unsigned int dim>
bool comb< dim >::operator== ( const comb< dim > &  t) const
inline

Compare two combination.

check if they match

Parameters
tcombination to check
Returns
true if the two combination match, false otherwise

Definition at line 237 of file comb.hpp.

◆ operator[]()

template<unsigned int dim>
signed char comb< dim >::operator[] ( int  i) const
inline

Get the i combination coefficient.

Parameters
icoefficent
Returns
the coefficent of the combination at position i

Definition at line 249 of file comb.hpp.

◆ sign_flip()

template<unsigned int dim>
void comb< dim >::sign_flip ( )
inline

Flip the sign of the combination.

Definition at line 124 of file comb.hpp.

◆ to_string()

template<unsigned int dim>
std::string comb< dim >::to_string ( ) const
inline

Convert a combination into string.

Returns
a string reppresentation of the combination

Definition at line 353 of file comb.hpp.

◆ value()

template<unsigned int dim>
signed char comb< dim >::value ( int  i) const
inline

get the index i of the combination

NOTE: used on expression template

Parameters
iindex
Returns
value of the i index

Definition at line 285 of file comb.hpp.

◆ zero()

template<unsigned int dim>
void comb< dim >::zero ( )
inline

Set all the elements to zero.

Definition at line 83 of file comb.hpp.

Field Documentation

◆ c

template<unsigned int dim>
signed char comb< dim >::c[dim]

Array that store the combination.

Definition at line 37 of file comb.hpp.


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