nec2++ 2.1.1
safe_array< T > Class Template Reference

A Safe Array class backed by Eigen for SIMD-accelerated operations. More...

#include <safe_array.h>

Inheritance diagram for safe_array< T >:
safe_matrix< T >

Public Types

using Vector = Eigen::Matrix<T, Eigen::Dynamic, 1>

Public Member Functions

 safe_array (int64_t in_size)
 safe_array (const safe_array< T > &in_array)
int64_t size () const
int64_t rows () const
int64_t cols () const
int64_t capacity () const
void resize (int64_t n_rows, int64_t n_cols)
void copy (const safe_array< T > &in_array)
void resize (int64_t new_length)
T maxCoeff () const
T minCoeff () const
T sum (int64_t start_index, int64_t stop_index)
T sum ()
void fill (int64_t start, int64_t N, const T &x)
void setConstant (const T &x)
void set_col_major (int64_t col_dim, int64_t col, int64_t row, const T &val)
T & get_col_major (int64_t col_dim, int64_t col, int64_t row)
T & getItem (int64_t row, int64_t col)
T & operator() (int64_t row, int64_t col)
const T & operator() (int64_t row, int64_t col) const
T & getItem (int64_t i)
const T & operator[] (int64_t i) const
T & operator[] (int64_t i)
safe_array< T > segment (int64_t start_index, int64_t end_index)
safe_array< T > eigen_segment (int64_t start_index, int64_t n)
T * data ()
const T * data () const
safe_array< T > & operator= (const safe_array< T > &in_array)

Protected Member Functions

 safe_array (const safe_array< T > &in_array, int64_t start_index, int64_t end_index, bool in_copy_data)
int64_t check (int64_t i) const
int64_t check (int64_t row, int64_t col) const

Protected Attributes

int64_t _len
int64_t _rows
int64_t _cols
int64_t _capacity
int64_t _resize_chunk
Vector _storage
T * _view_ptr
bool _own_data

Detailed Description

template<typename T>
class safe_array< T >

A Safe Array class backed by Eigen for SIMD-accelerated operations.

Bounds checking is done if the macro NEC_ERROR_CHECK is defined at compile time. Storage is column-major (Eigen default) to match FORTRAN/NEC conventions. Non-owning views (from segment()) use raw pointers to avoid Eigen expression template lifetime issues.


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