GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GNdarray Class Reference

N-dimensional array class. More...

#include <GNdarray.hpp>

Inheritance diagram for GNdarray:
GBase

Public Member Functions

 GNdarray (void)
 Void constructor. More...
 
 GNdarray (const int &nx)
 1-dimensional constructor More...
 
 GNdarray (const int &nx, const int &ny)
 2-dimensional constructor More...
 
 GNdarray (const int &nx, const int &ny, const int &nz)
 3-dimensional constructor More...
 
 GNdarray (const std::vector< int > &n)
 n-dimensional constructor More...
 
 GNdarray (const GNdarray &array)
 Copy constructor. More...
 
virtual ~GNdarray (void)
 Destructor. More...
 
double & operator() (const int &ix)
 1-dimensional array element access operator More...
 
double & operator() (const int &ix, const int &iy)
 2-dimensional array element access operator More...
 
double & operator() (const int &ix, const int &iy, const int &iz)
 3-dimensional array element access operator More...
 
double & operator() (const std::vector< int > &i)
 n-dimensional array element access operator More...
 
const double & operator() (const int &ix) const
 1-dimensional array element access operator (const variant) More...
 
const double & operator() (const int &ix, const int &iy) const
 2-dimensional array element access operator (const variant) More...
 
const double & operator() (const int &ix, const int &iy, const int &iz) const
 3-dimensional array element access operator (const variant) More...
 
const double & operator() (const std::vector< int > &i) const
 n-dimensional array element access operator (const variant) More...
 
GNdarrayoperator= (const GNdarray &array)
 Assignment operator. More...
 
bool operator== (const GNdarray &array) const
 Equality operator. More...
 
bool operator!= (const GNdarray &array) const
 Non-equality operator. More...
 
GNdarrayoperator+= (const GNdarray &array)
 Unary addition operator. More...
 
GNdarrayoperator-= (const GNdarray &array)
 Unary subtraction operator. More...
 
GNdarrayoperator*= (const GNdarray &array)
 Unary multiplication operator. More...
 
GNdarrayoperator/= (const GNdarray &array)
 Unary division operator. More...
 
GNdarrayoperator+= (const double &value)
 Unary value addition operator. More...
 
GNdarrayoperator-= (const double &value)
 Unary value subtraction operator. More...
 
GNdarrayoperator*= (const double &value)
 Unary multiplication operator. More...
 
GNdarrayoperator/= (const double &value)
 Unary division operator. More...
 
GNdarray operator- (void) const
 Unary minus operator. More...
 
void clear (void)
 Clear array. More...
 
GNdarrayclone (void) const
 Clone array. More...
 
std::string classname (void) const
 Return class name. More...
 
int dim (void) const
 Return dimension of array. More...
 
int size (void) const
 Return number of elements in array. More...
 
const std::vector< int > & shape (void) const
 Return shape of array. More...
 
const std::vector< int > & strides (void) const
 Return strides of array. More...
 
void shape (const std::vector< int > &shape)
 Set shape of array. More...
 
int index (const std::vector< int > &i) const
 Compute array element index. More...
 
std::vector< int > index (const int &index) const
 Compute index vector. More...
 
double & at (const int &ix)
 1-dimensional array element access with range checking More...
 
double & at (const int &ix, const int &iy)
 2-dimensional array element access with range checking More...
 
double & at (const int &ix, const int &iy, const int &iz)
 3-dimensional array element access with range checking More...
 
double & at (const std::vector< int > &i)
 n-dimensional array element access with range checking More...
 
const double & at (const int &ix) const
 1-dimensional array element access with range checking (const version) More...
 
const double & at (const int &ix, const int &iy) const
 2-dimensional array element access with range checking (const version) More...
 
const double & at (const int &ix, const int &iy, const int &iz) const
 3-dimensional array element access with range checking (const version) More...
 
const double & at (const std::vector< int > &i) const
 n-dimensional array element access with range checking (const version) More...
 
const double * data (void) const
 Data access method (const version) More...
 
double * data (void)
 Data access method. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print array information. More...
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor. More...
 

Protected Member Functions

void init_members (void)
 Initialise class members. More...
 
void copy_members (const GNdarray &array)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
bool has_same_shape (const GNdarray &array) const
 Check if array has the same shape. More...
 
void require_same_shape (const std::string &method, const GNdarray &array) const
 Throw exception if array shapes differ. More...
 

Protected Attributes

std::vector< int > m_shape
 Array dimensions. More...
 
std::vector< int > m_strides
 Steps in each dimension when traversing array. More...
 
std::vector< double > m_data
 Array data. More...
 

Friends

double min (const GNdarray &array)
 Computes minimum array element. More...
 
double max (const GNdarray &array)
 Computes maximum array element. More...
 
double sum (const GNdarray &array)
 Computes array sum. More...
 
GNdarray acos (const GNdarray &array)
 Computes arccos of array elements. More...
 
GNdarray acosh (const GNdarray &array)
 Computes acosh of array elements. More...
 
GNdarray asin (const GNdarray &array)
 Computes arcsin of array elements. More...
 
GNdarray asinh (const GNdarray &array)
 Computes asinh of array elements. More...
 
GNdarray atan (const GNdarray &array)
 Computes arctan of array elements. More...
 
GNdarray atanh (const GNdarray &array)
 Computes atanh of array elements. More...
 
GNdarray cos (const GNdarray &array)
 Computes cosine of array elements. More...
 
GNdarray cosh (const GNdarray &array)
 Computes cosh of array elements. More...
 
GNdarray exp (const GNdarray &array)
 Computes exponential of array elements. More...
 
GNdarray abs (const GNdarray &array)
 Computes absolute of array elements. More...
 
GNdarray log (const GNdarray &array)
 Computes natural logarithm of array elements. More...
 
GNdarray log10 (const GNdarray &array)
 Computes base10 logarithm of array elements. More...
 
GNdarray sign (const GNdarray &array)
 Computes sign of array elements. More...
 
GNdarray sin (const GNdarray &array)
 Computes sine of array elements. More...
 
GNdarray sinh (const GNdarray &array)
 Computes sinh of array elements. More...
 
GNdarray sqrt (const GNdarray &array)
 Computes square root of array elements. More...
 
GNdarray tan (const GNdarray &array)
 Computes tangens of array elements. More...
 
GNdarray tanh (const GNdarray &array)
 Computes tanh of array elements. More...
 
GNdarray pow (const GNdarray &array, const double &power)
 Computes tanh of array elements. More...
 

Detailed Description

N-dimensional array class.

This class implements a n-dimensional double precision floating point array.

Definition at line 44 of file GNdarray.hpp.

Constructor & Destructor Documentation

GNdarray::GNdarray ( void  )

Void constructor.

Definition at line 57 of file GNdarray.cpp.

References init_members().

Referenced by clone().

GNdarray::GNdarray ( const int &  nx)
explicit

1-dimensional constructor

Parameters
[in]nxArray dimension.

Constructs a 1-dimensional array.

Definition at line 74 of file GNdarray.cpp.

References init_members(), m_data, m_shape, and m_strides.

GNdarray::GNdarray ( const int &  nx,
const int &  ny 
)

2-dimensional constructor

Parameters
[in]nxArray's first dimension.
[in]nyArray's second dimension.

Constructs a 2-dimensional array.

Definition at line 101 of file GNdarray.cpp.

References init_members(), m_data, m_shape, m_strides, and size().

GNdarray::GNdarray ( const int &  nx,
const int &  ny,
const int &  nz 
)

3-dimensional constructor

Parameters
[in]nxArray's first dimension.
[in]nyArray's second dimension.
[in]nzArray's third dimension.

Constructs a 3-dimensional array.

Definition at line 134 of file GNdarray.cpp.

References init_members(), m_data, m_shape, m_strides, and size().

GNdarray::GNdarray ( const std::vector< int > &  n)

n-dimensional constructor

Parameters
[in]nArray dimensions.

Constructs a n-dimensional array. If the array dimension vector n is empty an empty n-dimensional array is constructed (similar to the void constructor).

Definition at line 169 of file GNdarray.cpp.

References init_members(), m_data, m_shape, m_strides, and size().

GNdarray::GNdarray ( const GNdarray array)

Copy constructor.

Parameters
[in]arrayArray.

Definition at line 208 of file GNdarray.cpp.

References copy_members(), and init_members().

GNdarray::~GNdarray ( void  )
virtual

Destructor.

Definition at line 224 of file GNdarray.cpp.

References free_members().

Member Function Documentation

double & GNdarray::at ( const int &  ix)
inline

1-dimensional array element access with range checking

Parameters
[in]ixElement index [0,...,shape(0)-1].
Returns
Reference to array element.

Definition at line 335 of file GNdarray.hpp.

References at().

Referenced by at().

double & GNdarray::at ( const int &  ix,
const int &  iy 
)
inline

2-dimensional array element access with range checking

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
Returns
Reference to array element.

Definition at line 349 of file GNdarray.hpp.

References at().

double & GNdarray::at ( const int &  ix,
const int &  iy,
const int &  iz 
)
inline

3-dimensional array element access with range checking

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
[in]izIndex in third dimension [0,...,shape(2)-1].
Returns
Reference to array element.

Definition at line 364 of file GNdarray.hpp.

References at().

double & GNdarray::at ( const std::vector< int > &  i)
inline

n-dimensional array element access with range checking

Parameters
[in]iIndex vector.
Returns
Reference to array element.

Definition at line 377 of file GNdarray.hpp.

References at().

const double & GNdarray::at ( const int &  ix) const

1-dimensional array element access with range checking (const version)

Parameters
[in]ixElement index [0,...,shape(0)-1].
Returns
Const reference to array element.
Exceptions
GException::invalid_valueArray is not 1-dimensional.
GException::out_of_rangeElement index is out of range.

Definition at line 604 of file GNdarray.cpp.

References G_AT1, m_shape, and gammalib::str().

const double & GNdarray::at ( const int &  ix,
const int &  iy 
) const

2-dimensional array element access with range checking (const version)

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
Returns
Const reference to array element.
Exceptions
GException::invalid_valueArray is not 2-dimensional.
GException::out_of_rangeElement index is out of range.

Definition at line 637 of file GNdarray.cpp.

References G_AT2, m_shape, and gammalib::str().

const double & GNdarray::at ( const int &  ix,
const int &  iy,
const int &  iz 
) const

3-dimensional array element access with range checking (const version)

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
[in]izIndex in third dimension [0,...,shape(2)-1].
Returns
Const reference to array element.
Exceptions
GException::invalid_valueArray is not 3-dimensional.
GException::out_of_rangeElement index is out of range.

Definition at line 676 of file GNdarray.cpp.

References G_AT3, m_shape, and gammalib::str().

const double & GNdarray::at ( const std::vector< int > &  i) const

n-dimensional array element access with range checking (const version)

Parameters
[in]iIndex vector.
Returns
Const reference to array element.
Exceptions
GException::invalid_valueArray is not of correct dimension.
GException::out_of_rangeElement index is out of range.

Definition at line 717 of file GNdarray.cpp.

References G_ATN, m_shape, and gammalib::str().

std::string GNdarray::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GNdarray").

Implements GBase.

Definition at line 148 of file GNdarray.hpp.

void GNdarray::clear ( void  )
virtual

Clear array.

Implements GBase.

Definition at line 527 of file GNdarray.cpp.

References free_members(), and init_members().

Referenced by GModelSpectralTable::init_members(), GCOMDris::init_members(), and GSkyMap::init_members().

GNdarray * GNdarray::clone ( void  ) const
virtual

Clone array.

Returns
Pointer to deep copy of array.

Implements GBase.

Definition at line 545 of file GNdarray.cpp.

References GNdarray().

void GNdarray::copy_members ( const GNdarray array)
protected

Copy class members.

Parameters
[in]arrayArray.

Definition at line 861 of file GNdarray.cpp.

References m_data, m_shape, and m_strides.

Referenced by GNdarray(), and operator=().

const double * GNdarray::data ( void  ) const
inline

Data access method (const version)

Returns
Const reference to array data.

Definition at line 389 of file GNdarray.hpp.

References m_data.

Referenced by GSkyMap::convolve(), GSkyMap::create_healpix_hdu(), GSkyMap::create_wcs_hdu(), GSkyMap::extract(), GSkyMap::operator()(), GSkyMap::pixels(), GSkyMap::read_healpix(), and GSkyMap::read_wcs().

double * GNdarray::data ( void  )
inline

Data access method.

Returns
Reference to array data.

Definition at line 401 of file GNdarray.hpp.

References m_data.

int GNdarray::dim ( void  ) const
inline

Return dimension of array.

Returns
Dimension of array

Returns the dimension of the array.

Definition at line 280 of file GNdarray.hpp.

References m_shape.

Referenced by GFft::backward(), GModelSpectralTable::create_spec_table(), GFft::forward(), GModelSpectralTable::GModelSpectralTable(), index(), and GModelSpectralTable::print().

void GNdarray::free_members ( void  )
protected

Delete class members.

Definition at line 876 of file GNdarray.cpp.

Referenced by clear(), operator=(), and ~GNdarray().

bool GNdarray::has_same_shape ( const GNdarray array) const
protected

Check if array has the same shape.

Parameters
[in]arrayArray.
Returns
True if the array has the same shape.

Definition at line 889 of file GNdarray.cpp.

References m_shape.

Referenced by operator==(), and require_same_shape().

int GNdarray::index ( const std::vector< int > &  i) const

Compute array element index.

Parameters
[in]iIndex vector.
Returns
Array element index.

Computes the array element index from an index vector. The method assumes that the index vector has the same dimension as the array. If this condition is not guaranteed, the condition needs to be checked before calling the method.

Definition at line 754 of file GNdarray.cpp.

References m_shape, and m_strides.

Referenced by index(), operator()(), and GModelSpectralTable::scale_energy().

std::vector< int > GNdarray::index ( const int &  index) const

Compute index vector.

Parameters
[in]indexArray element index.
Returns
Index vector.

Computes index vector from an array element index.

Definition at line 777 of file GNdarray.cpp.

References dim(), index(), m_shape, m_strides, and strides().

void GNdarray::init_members ( void  )
protected

Initialise class members.

Definition at line 841 of file GNdarray.cpp.

References m_data, m_shape, and m_strides.

Referenced by clear(), GNdarray(), and operator=().

bool GNdarray::operator!= ( const GNdarray array) const

Non-equality operator.

Parameters
[in]arrayArray.
Returns
True if arrays are different.

Returns true if the arrays have different shape or content.

Definition at line 304 of file GNdarray.cpp.

References operator==().

double & GNdarray::operator() ( const int &  ix)
inline

1-dimensional array element access operator

Parameters
[in]ixElement index [0,...,shape(0)-1].
Returns
Reference to array element.

Definition at line 161 of file GNdarray.hpp.

References m_data.

double & GNdarray::operator() ( const int &  ix,
const int &  iy 
)
inline

2-dimensional array element access operator

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
Returns
Reference to array element.

Definition at line 176 of file GNdarray.hpp.

References m_data, and m_strides.

double & GNdarray::operator() ( const int &  ix,
const int &  iy,
const int &  iz 
)
inline

3-dimensional array element access operator

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
[in]izIndex in third dimension [0,...,shape(2)-1].
Returns
Reference to array element.

Definition at line 192 of file GNdarray.hpp.

References m_data, and m_strides.

double & GNdarray::operator() ( const std::vector< int > &  i)
inline

n-dimensional array element access operator

Parameters
[in]iIndex vector.
Returns
Reference to array element.

Definition at line 206 of file GNdarray.hpp.

References index(), and m_data.

const double & GNdarray::operator() ( const int &  ix) const
inline

1-dimensional array element access operator (const variant)

Parameters
[in]ixElement index [0,...,shape(0)-1].
Returns
Const reference to array element.

Definition at line 220 of file GNdarray.hpp.

References m_data.

const double & GNdarray::operator() ( const int &  ix,
const int &  iy 
) const
inline

2-dimensional array element access operator (const variant)

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
Returns
Const reference to array element.

Definition at line 235 of file GNdarray.hpp.

References m_data, and m_strides.

const double & GNdarray::operator() ( const int &  ix,
const int &  iy,
const int &  iz 
) const
inline

3-dimensional array element access operator (const variant)

Parameters
[in]ixIndex in first dimension [0,...,shape(0)-1].
[in]iyIndex in second dimension [0,...,shape(1)-1].
[in]izIndex in third dimension [0,...,shape(2)-1].
Returns
Const reference to array element.

Definition at line 251 of file GNdarray.hpp.

References m_data, and m_strides.

const double & GNdarray::operator() ( const std::vector< int > &  i) const
inline

n-dimensional array element access operator (const variant)

Parameters
[in]iIndex vector.
Returns
Const reference to array element.

Definition at line 265 of file GNdarray.hpp.

References index(), and m_data.

GNdarray & GNdarray::operator*= ( const GNdarray array)

Unary multiplication operator.

Parameters
[in]arrayArray.
Returns
Array.

Multiply an array by the current array.

Definition at line 345 of file GNdarray.cpp.

References G_OP_MUL, m_data, and require_same_shape().

GNdarray & GNdarray::operator*= ( const double &  value)

Unary multiplication operator.

Parameters
[in]valueValue.
Returns
Array.

Multiply all array elements by a value.

Definition at line 464 of file GNdarray.cpp.

References m_data.

GNdarray & GNdarray::operator+= ( const GNdarray array)

Unary addition operator.

Parameters
[in]arrayArray.
Returns
Array.

Adds an array to the current array.

Definition at line 322 of file GNdarray.cpp.

References G_OP_ADD, m_data, and require_same_shape().

GNdarray & GNdarray::operator+= ( const double &  value)

Unary value addition operator.

Parameters
[in]valueValue.
Returns
Array.

Adds a value to all array elements.

Definition at line 424 of file GNdarray.cpp.

References m_data.

GNdarray GNdarray::operator- ( void  ) const

Unary minus operator.

Returns
Array.

Negate all array elements.

Definition at line 503 of file GNdarray.cpp.

References m_data.

GNdarray & GNdarray::operator-= ( const GNdarray array)

Unary subtraction operator.

Parameters
[in]arrayArray.
Returns
Array.

Subtracts an array from the current array.

Definition at line 401 of file GNdarray.cpp.

References G_OP_SUB, m_data, and require_same_shape().

GNdarray & GNdarray::operator-= ( const double &  value)

Unary value subtraction operator.

Parameters
[in]valueValue.
Returns
Array.

Subtracts a value from all array elements.

Definition at line 444 of file GNdarray.cpp.

References m_data.

GNdarray & GNdarray::operator/= ( const GNdarray array)

Unary division operator.

Parameters
[in]arrayArray.
Returns
Array.

Divide current array by array.

Definition at line 368 of file GNdarray.cpp.

References G_OP_DIV, m_data, and require_same_shape().

GNdarray & GNdarray::operator/= ( const double &  value)

Unary division operator.

Parameters
[in]valueValue.
Returns
Array.

Divide all array elements by a value.

Definition at line 484 of file GNdarray.cpp.

References m_data.

GNdarray & GNdarray::operator= ( const GNdarray array)

Assignment operator.

Parameters
[in]arrayArray.
Returns
Array.

Definition at line 246 of file GNdarray.cpp.

References copy_members(), free_members(), and init_members().

bool GNdarray::operator== ( const GNdarray array) const

Equality operator.

Parameters
[in]arrayArray.
Returns
True if arrays are identical.

Returns true if the arrays have identical shape and content.

Definition at line 275 of file GNdarray.cpp.

References has_same_shape(), and m_data.

Referenced by operator!=().

std::string GNdarray::print ( const GChatter chatter = NORMAL) const
virtual

Print array information.

Parameters
[in]chatterChattiness.
Returns
String containing array information.

Implements GBase.

Definition at line 806 of file GNdarray.cpp.

References m_data, SILENT, and gammalib::str().

void GNdarray::require_same_shape ( const std::string &  method,
const GNdarray array 
) const
protected

Throw exception if array shapes differ.

Parameters
[in]methodMethod that throws exception.
[in]arrayArray.

Definition at line 916 of file GNdarray.cpp.

References has_same_shape(), m_shape, and gammalib::str().

Referenced by operator*=(), operator+=(), operator-=(), and operator/=().

const std::vector< int > & GNdarray::shape ( void  ) const
inline
void GNdarray::shape ( const std::vector< int > &  shape)

Set shape of array.

Parameters
[in]shapeShape vector.
Exceptions
GException::invalid_argumentInvalid shape factorisation specified.

Set the shape of the array. The shape specifies how the information is arranged in a n-dimensional array.

Definition at line 563 of file GNdarray.cpp.

References G_SHAPE, m_shape, shape(), size(), and gammalib::str().

int GNdarray::size ( void  ) const
inline

Return number of elements in array.

Returns
Number of elements in array

Returns the number of elements in the array.

Definition at line 294 of file GNdarray.hpp.

References m_data.

Referenced by GNdarray(), GSkyMap::operator=(), GFft::set_data(), shape(), GCTAEdisp2D::smooth_array(), and GCTAEdisp2D::smoothed_array_value().

const std::vector< int > & GNdarray::strides ( void  ) const
inline

Return strides of array.

Returns
Strides of array

Returns the strides of the array.

Definition at line 322 of file GNdarray.hpp.

References m_strides.

Referenced by index(), and GFft::set_data().

Friends And Related Function Documentation

GNdarray abs ( const GNdarray array)
friend

Computes absolute of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the absolute of every element.

Definition at line 1227 of file GNdarray.cpp.

GNdarray acos ( const GNdarray array)
friend

Computes arccos of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the arccos of every element.

Definition at line 1038 of file GNdarray.cpp.

GNdarray acosh ( const GNdarray array)
friend

Computes acosh of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the acosh of every element.

Definition at line 1059 of file GNdarray.cpp.

GNdarray asin ( const GNdarray array)
friend

Computes arcsin of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the arcsin of every element.

Definition at line 1080 of file GNdarray.cpp.

GNdarray asinh ( const GNdarray array)
friend

Computes asinh of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the asinh of every element.

Definition at line 1101 of file GNdarray.cpp.

GNdarray atan ( const GNdarray array)
friend

Computes arctan of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the arctan of every element.

Definition at line 1122 of file GNdarray.cpp.

GNdarray atanh ( const GNdarray array)
friend

Computes atanh of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the atanh of every element.

Definition at line 1143 of file GNdarray.cpp.

GNdarray cos ( const GNdarray array)
friend

Computes cosine of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the cosine of every element.

Definition at line 1164 of file GNdarray.cpp.

GNdarray cosh ( const GNdarray array)
friend

Computes cosh of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the cosh of every element.

Definition at line 1185 of file GNdarray.cpp.

GNdarray exp ( const GNdarray array)
friend

Computes exponential of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the exponential of every element.

Definition at line 1206 of file GNdarray.cpp.

GNdarray log ( const GNdarray array)
friend

Computes natural logarithm of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the natural logarithm of every element.

Definition at line 1248 of file GNdarray.cpp.

GNdarray log10 ( const GNdarray array)
friend

Computes base10 logarithm of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the base10 logarithm of every element.

Definition at line 1310 of file GNdarray.cpp.

double max ( const GNdarray array)
friend

Computes maximum array element.

Parameters
[in]arrayArray.
Returns
Maximum array element.

Definition at line 990 of file GNdarray.cpp.

double min ( const GNdarray array)
friend

Computes minimum array element.

Parameters
[in]arrayArray.
Returns
Minimum array element.

Definition at line 961 of file GNdarray.cpp.

GNdarray pow ( const GNdarray array,
const double &  power 
)
friend

Computes tanh of array elements.

Parameters
[in]arrayArray.
[in]powerPower.
Returns
Array containing the power of every element.

Definition at line 1437 of file GNdarray.cpp.

GNdarray sign ( const GNdarray array)
friend

Computes sign of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the sign of every element.

Definition at line 1269 of file GNdarray.cpp.

GNdarray sin ( const GNdarray array)
friend

Computes sine of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the sine of every element.

Definition at line 1331 of file GNdarray.cpp.

GNdarray sinh ( const GNdarray array)
friend

Computes sinh of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the sinh of every element.

Definition at line 1352 of file GNdarray.cpp.

GNdarray sqrt ( const GNdarray array)
friend

Computes square root of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the square root of every element.

Definition at line 1373 of file GNdarray.cpp.

double sum ( const GNdarray array)
friend

Computes array sum.

Parameters
[in]arrayArray.
Returns
Sum of array elements.

Definition at line 1019 of file GNdarray.cpp.

GNdarray tan ( const GNdarray array)
friend

Computes tangens of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the tangens of every element.

Definition at line 1394 of file GNdarray.cpp.

GNdarray tanh ( const GNdarray array)
friend

Computes tanh of array elements.

Parameters
[in]arrayArray.
Returns
Array containing the tanh of every element.

Definition at line 1415 of file GNdarray.cpp.

Member Data Documentation

std::vector<int> GNdarray::m_shape
protected

Array dimensions.

Definition at line 136 of file GNdarray.hpp.

Referenced by at(), copy_members(), dim(), GNdarray(), has_same_shape(), index(), init_members(), require_same_shape(), and shape().

std::vector<int> GNdarray::m_strides
protected

Steps in each dimension when traversing array.

Definition at line 137 of file GNdarray.hpp.

Referenced by copy_members(), GNdarray(), index(), init_members(), operator()(), and strides().


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