#include <TensorIndex.h>
Public Types | |
enum | { SIZE = d1*d2*d3*d4 } |
enum | { LEN1 = d1 } |
enum | { LEN2 = d2 } |
enum | { LEN3 = d3 } |
enum | { LEN4 = d4 } |
Static Public Member Functions | |
static int | indexOf (const int i) |
static int | indexOf (const int i, const int j, const int k, const int l) |
static int | indexOf (const int i, const int j, const int k) |
static int | indexOf (const int i, const int j) |
Credit: Utility class from
https://www.sitmo.com/doc/A_Simple_and_Extremely_Fast_CPP_Template_for_Matrices_and_Tensors
Usage:
The template below offers a simple and efficient solution for handling matrices and tensors in C++. The idea is to store the matrix (or tensor) in a standard vector by translating the multidimensional index to a one dimensional index.
The only thing we need to do is to convert two dimensional indices (r,c) into a one dimensional index. Using template we can do this very efficiently compile time, minimizing the runtime overhead.
Definition at line 16 of file TensorIndex.h.
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
static int TensorIndex< d1, d2, d3, d4 >::indexOf | ( | const int | i | ) | [inline, static] |
Definition at line 24 of file TensorIndex.h.
References i.
Referenced by big::bigEntry::fill().
{ return i; }
static int TensorIndex< d1, d2, d3, d4 >::indexOf | ( | const int | i, |
const int | j, | ||
const int | k, | ||
const int | l | ||
) | [inline, static] |
Definition at line 33 of file TensorIndex.h.
References debug_cff::d1, and i.
static int TensorIndex< d1, d2, d3, d4 >::indexOf | ( | const int | i, |
const int | j, | ||
const int | k | ||
) | [inline, static] |
Definition at line 30 of file TensorIndex.h.
References debug_cff::d1, and i.
static int TensorIndex< d1, d2, d3, d4 >::indexOf | ( | const int | i, |
const int | j | ||
) | [inline, static] |