HILA
Loading...
Searching...
No Matches
array.h File Reference

Definition of Array class. More...

#include "datatypes/matrix.h"
Include dependency graph for array.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Array< n, m, T >
 \( n\times m \) Array type More...
 

Namespaces

namespace  hila
 Implement hila::swap for gauge fields.
 

Typedefs

template<int n, typename T = double>
using Array1d = Array< n, 1, T >
 Array1d and Array2d are just aliased to Array.
 
template<int n, int m, typename T = double>
using Array2d = Array< n, m, T >
 Array1d and Array2d are just aliased to Array.
 

Functions

template<const int n, const int m, typename T >
Array< n, m, T > conj (const Array< n, m, T > &arg)
 Return conjugate Array.
 
template<const int n, const int m, typename T >
Array< n, m, hila::arithmetic_type< T > > real (const Array< n, m, T > &arg)
 Return real part of Array.
 
template<const int n, const int m, typename T >
Array< n, m, hila::arithmetic_type< T > > imag (const Array< n, m, T > &arg)
 Return imaginary part of Array.
 
template<int n, int m, typename A , typename B >
auto operator+ (const Array< n, m, A > &a, const Array< n, m, B > &b)
 Addition operator.
 
template<int n, int m, typename A , typename B >
auto operator- (const Array< n, m, A > &a, const Array< n, m, B > &b)
 Subtraction operator.
 
template<int n, int m, typename T >
Array< n, m, T > operator* (Array< n, m, T > a, const Array< n, m, T > &b)
 Multiplication operator.
 
template<int n, int m, typename A , typename B >
auto operator/ (const Array< n, m, A > &a, const Array< n, m, B > &b)
 Division operator.
 
template<int n, int m, typename T >
std::ostream & operator<< (std::ostream &strm, const Array< n, m, T > &A)
 Stream operator.
 
template<int n, int m, typename T >
std::string hila::to_string (const Array< n, m, T > &A, int prec=8, char separator=' ')
 Converts Array object to string.
 
template<int n, int m, typename T >
hila::arithmetic_type< T > squarenorm (const Array< n, m, T > &rhs)
 Return square norm of Array.
 
template<typename Ntype , typename T , int n, int m, std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, Ntype > cast_to (const Array< n, m, T > &mat)
 Array casting operation.
 
Arithmetic operations

all operations are applied linearly to the Array A

Most functions are self explanitory, but if necessary function will have a detailed section with additional information.

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
aInput array
Returns
Array<n, m, T>
template<int n, int m, typename T >
Array< n, m, T > sqrt (Array< n, m, T > a)
 Square root.
 
template<int n, int m, typename T >
Array< n, m, T > cbrt (Array< n, m, T > a)
 Cuberoot.
 
template<int n, int m, typename T >
Array< n, m, T > exp (Array< n, m, T > a)
 Exponential.
 
template<int n, int m, typename T >
Array< n, m, T > log (Array< n, m, T > a)
 Logarithm.
 
template<int n, int m, typename T >
Array< n, m, T > sin (Array< n, m, T > a)
 Sine.
 
template<int n, int m, typename T >
Array< n, m, T > cos (Array< n, m, T > a)
 Cosine.
 
template<int n, int m, typename T >
Array< n, m, T > tan (Array< n, m, T > a)
 Tangent.
 
template<int n, int m, typename T >
Array< n, m, T > asin (Array< n, m, T > a)
 Inverse Sine.
 
template<int n, int m, typename T >
Array< n, m, T > acos (Array< n, m, T > a)
 Inverse Cosine.
 
template<int n, int m, typename T >
Array< n, m, T > atan (Array< n, m, T > a)
 Inverse Tangent.
 
template<int n, int m, typename T >
Array< n, m, T > sinh (Array< n, m, T > a)
 Hyperbolic Sine.
 
template<int n, int m, typename T >
Array< n, m, T > cosh (Array< n, m, T > a)
 Hyperbolic Cosine.
 
template<int n, int m, typename T >
Array< n, m, T > tanh (Array< n, m, T > a)
 Hyperbolic tangent.
 
template<int n, int m, typename T >
Array< n, m, T > asinh (Array< n, m, T > a)
 Inverse Hyperbolic Sine.
 
template<int n, int m, typename T >
Array< n, m, T > acosh (Array< n, m, T > a)
 Inverse Hyperbolic Cosine.
 
template<int n, int m, typename T >
Array< n, m, T > atanh (Array< n, m, T > a)
 Inverse Hyperbolic Tangent.
 
template<int n, int m, typename T >
Array< n, m, T > pow (Array< n, m, T > a, int b)
 Power.
 
template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > round (Array< n, m, T > a)
 Rounding.
 
template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > floor (Array< n, m, T > a)
 Floor.
 
template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > ceil (Array< n, m, T > a)
 Ceiling.
 
template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > trunc (Array< n, m, T > a)
 Truncation.
 

Detailed Description

Definition of Array class.

This file contains the definitions of Array class and utility functions related to it.

Definition in file array.h.

Function Documentation

◆ cast_to()

template<typename Ntype , typename T , int n, int m, std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, Ntype > cast_to ( const Array< n, m, T > &  mat)

Array casting operation.

Cast array to different number type or Complex type

Allowed casting: number->number, number->Complex, Complex->Complex

Not allowed casting: Complex->number

Template Parameters
NtypeType to cast to
TInput Array type
nNumber of rows
mNumber of columns
Parameters
matArray to cast
Returns
Array<n, m, Ntype>

Definition at line 1289 of file array.h.

◆ ceil()

template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > ceil ( Array< n, m, T >  a)
inline

Ceiling.

Ceiling function if T is arithmetic type

Template Parameters
TArray element type, must be arithmetic type

Definition at line 1254 of file array.h.

◆ conj()

template<const int n, const int m, typename T >
Array< n, m, T > conj ( const Array< n, m, T > &  arg)
inline

Return conjugate Array.

Wrapper around Array::conj

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
argArray to be conjugated
Returns
Array<n, m, T>

Definition at line 674 of file array.h.

◆ floor()

template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > floor ( Array< n, m, T >  a)
inline

Floor.

Flooring function if T is arithmetic type

Template Parameters
TArray element type, must be arithmetic type

Definition at line 1242 of file array.h.

◆ imag()

template<const int n, const int m, typename T >
Array< n, m, hila::arithmetic_type< T > > imag ( const Array< n, m, T > &  arg)
inline

Return imaginary part of Array.

Wrapper around Array::imag

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
argArray to return real part of
Returns
Array<n, m, T>

Definition at line 702 of file array.h.

◆ operator*()

template<int n, int m, typename T >
Array< n, m, T > operator* ( Array< n, m, T >  a,
const Array< n, m, T > &  b 
)
inline

Multiplication operator.

Defined for the following operations

Array*Array:

NOTE: Arrays must share same dimensionality

A = 2;
B = 3;
C = A*B; // C is uniformly 6
Array type
Definition array.h:43

Scalar * Array / Array * Scalar:

NOTE: Exact definition exist in overloaded functions that can be viewed in source code.

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
a
b
Returns
Array<n, m, T>

Definition at line 861 of file array.h.

◆ operator+()

template<int n, int m, typename A , typename B >
auto operator+ ( const Array< n, m, A > &  a,
const Array< n, m, B > &  b 
)
inline

Addition operator.

Defined for the following operations

Array + Array:

NOTE: Arrays must share same dimensionality

A = 1;
B = 1;
C = A + B; // C is uniformly 2

Scalar + Array / Array + Scalar:

NOTE: Exact definition exist in overloaded functions that can be viewed in source code.

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
a
b
Returns
Array<n, m, T>

Definition at line 740 of file array.h.

◆ operator-()

template<int n, int m, typename A , typename B >
auto operator- ( const Array< n, m, A > &  a,
const Array< n, m, B > &  b 
)
inline

Subtraction operator.

Defined for the following operations

Array - Array:

NOTE: Arrays must share same dimensionality

A = 2;
B = 1;
C = A - B; // C is uniformly 2

Scalar - Array / Array - Scalar:

NOTE: Exact definition exist in overloaded functions that can be viewed in source code.

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
a
b
Returns
Array<n, m, T>

Definition at line 781 of file array.h.

◆ operator/()

template<int n, int m, typename A , typename B >
auto operator/ ( const Array< n, m, A > &  a,
const Array< n, m, B > &  b 
)
inline

Division operator.

Defined for the following operations

Array/Array:

NOTE: Arrays must share same dimensionality

A = 4;
B = 2;
C = A/B; // C is uniformly 2

Scalar / Array / Array / Scalar:

NOTE: Exact definition exist in overloaded functions that can be viewed in source code.

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
a
b
Returns
Array<n, m, T>

Definition at line 916 of file array.h.

◆ operator<<()

template<int n, int m, typename T >
std::ostream & operator<< ( std::ostream &  strm,
const Array< n, m, T > &  A 
)

Stream operator.

Naive Stream operator for formatting Matrix for printing. Simply puts elements one after the other in row major order

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
strmOS stream
AArray to write
Returns
std::ostream&

Definition at line 977 of file array.h.

◆ pow()

template<int n, int m, typename T >
Array< n, m, T > pow ( Array< n, m, T >  a,
int  b 
)
inline

Power.

Array can be raised homogeneously to the power of a integer or scalar b or Array can be raised to the power of another Array b element wise.

Parameters
bArray, Integer or Real scalar to raise to the power of

Definition at line 1204 of file array.h.

◆ real()

template<const int n, const int m, typename T >
Array< n, m, hila::arithmetic_type< T > > real ( const Array< n, m, T > &  arg)
inline

Return real part of Array.

Wrapper around Array::real

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
argArray to return real part of
Returns
Array<n, m, T>

Definition at line 688 of file array.h.

◆ round()

template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > round ( Array< n, m, T >  a)
inline

Rounding.

Rounding function if T is arithmetic type

Template Parameters
TArray element type, must be arithmetic type

Definition at line 1230 of file array.h.

◆ squarenorm()

template<int n, int m, typename T >
hila::arithmetic_type< T > squarenorm ( const Array< n, m, T > &  rhs)
inline

Return square norm of Array.

Wrapper around Array::squarenrom

Template Parameters
nNumber of rows
mNumber of columns
TArray element type
Parameters
rhsArray to compute squarenorm of
Returns
hila::arithmetic_type<T>

Definition at line 1018 of file array.h.

◆ trunc()

template<int n, int m, typename T , std::enable_if_t< hila::is_arithmetic< T >::value, int > = 0>
Array< n, m, T > trunc ( Array< n, m, T >  a)
inline

Truncation.

Truncation function if T is arithmetic type

Template Parameters
TArray element type, must be arithmetic type

Definition at line 1266 of file array.h.