QUGaR 0.0.4
Loading...
Searching...
No Matches
qugar::TensorSizeTP< dim > Class Template Reference

Class representing a dim-dimensional tensor-product sizes container. More...

#include <tensor_index_tp.hpp>

Inheritance diagram for qugar::TensorSizeTP< dim >:
[legend]
Collaboration diagram for qugar::TensorSizeTP< dim >:
[legend]

Public Member Functions

Constructors
 TensorSizeTP ()
 Default constructor. Initializes indices to zero.
 
 TensorSizeTP (const int size)
 Construct a new TensorSizeTP object from size along directions.
 
 TensorSizeTP (const Vector< int, dim > &sizes)
 Construct a new TensorSizeTP object from sizes along directions.
 
 TensorSizeTP (const TensorIndexTP< dim > &sizes)
 Construct a new TensorSizeTP object from sizes along directions.
 
const Vector< int, dim > & as_Vector () const
 Returns the tensor size casted as a Vector.
 
Vector< int, dim > & as_Vector ()
 Returns the tensor size casted as a Vector.
 
int size () const
 Gets the total number of entries (product of sizes along all directions).
 
bool operator== (const TensorSizeTP< dim > &rhs) const
 Checks if two tensor sizes are equal by comparing all its components. They are equal if all the components are equal.
 
TensorSizeTP< dim > operator+ (const TensorSizeTP< dim > &rhs) const
 Adds two TensorSizeTP objects.
 

Detailed Description

template<int dim>
class qugar::TensorSizeTP< dim >

Class representing a dim-dimensional tensor-product sizes container.

Template Parameters
dimDimension of the container.

Constructor & Destructor Documentation

◆ TensorSizeTP() [1/4]

template<int dim>
qugar::TensorSizeTP< dim >::TensorSizeTP ( )

Default constructor. Initializes indices to zero.

◆ TensorSizeTP() [2/4]

template<int dim>
qugar::TensorSizeTP< dim >::TensorSizeTP ( const int size)
explicit

Construct a new TensorSizeTP object from size along directions.

Parameters
sizeSizs along all the parametric directions.

◆ TensorSizeTP() [3/4]

template<int dim>
qugar::TensorSizeTP< dim >::TensorSizeTP ( const Vector< int, dim > & sizes)
explicit

Construct a new TensorSizeTP object from sizes along directions.

Parameters
sizesSizes along the parametric directions.

◆ TensorSizeTP() [4/4]

template<int dim>
qugar::TensorSizeTP< dim >::TensorSizeTP ( const TensorIndexTP< dim > & sizes)
explicit

Construct a new TensorSizeTP object from sizes along directions.

Parameters
sizesSizes along the parametric directions.

Member Function Documentation

◆ as_Vector() [1/2]

template<int dim>
Vector< int, dim > & qugar::TensorSizeTP< dim >::as_Vector ( )

Returns the tensor size casted as a Vector.

Returns
A constant reference to a Vector.
Note
Non-constant version.

◆ as_Vector() [2/2]

template<int dim>
const Vector< int, dim > & qugar::TensorSizeTP< dim >::as_Vector ( ) const

Returns the tensor size casted as a Vector.

Returns
A constant reference to a Vector.
Note
Constant version.

◆ operator+()

template<int dim>
TensorSizeTP< dim > qugar::TensorSizeTP< dim >::operator+ ( const TensorSizeTP< dim > & rhs) const
nodiscard

Adds two TensorSizeTP objects.

This operator performs element-wise addition of two TensorSizeTP objects.

Parameters
rhsThe right-hand side TensorSizeTP object to be added.
Returns
A new TensorSizeTP object that is the result of the addition.

◆ operator==()

template<int dim>
bool qugar::TensorSizeTP< dim >::operator== ( const TensorSizeTP< dim > & rhs) const
nodiscard

Checks if two tensor sizes are equal by comparing all its components. They are equal if all the components are equal.

Returns
Whether they are equal or not.

◆ size()

template<int dim>
int qugar::TensorSizeTP< dim >::size ( ) const
nodiscard

Gets the total number of entries (product of sizes along all directions).

Returns
Total number of entries.

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