36 #define G_CONSTRUCTOR "GVector::GVector(int&)"
37 #define G_OP_ADD "GVector::operator+=(GVector&)"
38 #define G_OP_SUB "GVector::operator-=(GVector&)"
39 #define G_AT "GVector::at(int&)"
40 #define G_CROSS "cross(GVector&, GVector&)"
41 #define G_SCALAR "operator*(GVector&, GVector&)"
42 #define G_ANGLE "angle(GVector&, GVector&)"
79 #if defined(G_RANGE_CHECK)
81 std::string msg =
"Number of elements "+
gammalib::str(num)+
" is "
82 "negative. Please specify a non-negative number of "
231 if (
this != &vector) {
265 for (
int i = 0; i <
m_num; ++i) {
311 ". Please specify a vector of size "+
317 for (
int i = 0; i <
m_num; ++i) {
343 ". Please specify a vector of size "+
349 for (
int i = 0; i <
m_num; ++i) {
369 for (
int i = 0; i <
m_num; ++i) {
389 for (
int i = 0; i <
m_num; ++i) {
409 for (
int i = 0; i <
m_num; ++i) {
429 for (
int i = 0; i <
m_num; ++i) {
449 for (
int i = 0; i <
m_num; ++i) {
471 for (
int i = 0; i <
m_num; ++i) {
525 if (index < 0 || index >=
size()) {
545 if (index < 0 || index >=
size()) {
565 for (
int i = 0; i <
m_num; ++i) {
586 int first_non_zero = -1;
589 for (
int i = 0; i <
m_num; ++i) {
597 return first_non_zero;
612 int last_non_zero = -1;
615 for (
int i =
m_num-1; i >= 0; --i) {
623 return last_non_zero;
637 int num = stop - start;
646 for (
int i = start; i <= stop; ++i) {
664 std::string result =
"(";
670 for (
int i = 0; i <
m_num; ++i) {
719 for (
int i = 0; i <
m_num; ++i) {
747 for (
int i = 0; i <
m_num; ++i) {
799 "second vector. Please specify vectors of identical "
807 "The vector cross product is only defined for "
808 "vectors of size 3. Please specify vectors of "
842 "second vector. Please specify vectors of identical "
849 for (
int i = 0; i < a.
m_num; ++i) {
870 for (
int i = 0; i < vector.
m_num; ++i) {
873 result = (result > 0.0) ?
std::sqrt(result) : 0.0;
892 if (vector.
m_num > 0) {
895 result = vector.
m_data[0];
896 for (
int i = 1; i < vector.
m_num; ++i) {
897 if (vector.
m_data[i] < result) {
898 result = vector.
m_data[i];
921 if (vector.
m_num > 0) {
924 result = vector.
m_data[0];
925 for (
int i = 1; i < vector.
m_num; ++i) {
926 if (vector.
m_data[i] > result) {
927 result = vector.
m_data[i];
948 for (
int i = 0; i < vector.
m_num; ++i) {
949 result += vector.
m_data[i];
980 "second vector. Please specify vectors of identical "
989 double arg = (a * b) / denom;
1018 for (
int i = 0; i < vector.
m_num; ++i) {
1045 for (
int i = 0; i < vector.
m_num; ++i) {
1070 for (
int i = 0; i < vector.
m_num; ++i) {
1091 for (
int i = 0; i < vector.
m_num; ++i) {
1112 for (
int i = 0; i < vector.
m_num; ++i) {
1133 for (
int i = 0; i < vector.
m_num; ++i) {
1154 for (
int i = 0; i < vector.
m_num; ++i) {
1175 for (
int i = 0; i < vector.
m_num; ++i) {
1196 for (
int i = 0; i < vector.
m_num; ++i) {
1217 for (
int i = 0; i < vector.
m_num; ++i) {
1238 for (
int i = 0; i < vector.
m_num; ++i) {
1259 for (
int i = 0; i < vector.
m_num; ++i) {
1280 for (
int i = 0; i < vector.
m_num; ++i) {
1301 for (
int i = 0; i < vector.
m_num; ++i) {
1322 for (
int i = 0; i < vector.
m_num; ++i) {
1343 for (
int i = 0; i < vector.
m_num; ++i) {
1364 for (
int i = 0; i < vector.
m_num; ++i) {
1385 for (
int i = 0; i < vector.
m_num; ++i) {
1406 for (
int i = 0; i < vector.
m_num; ++i) {
1428 for (
int i = 0; i < vector.
m_num; ++i) {
GVector slice(const int &start, const int &stop) const
Vector slice operator.
void alloc_members(void)
Allocate vector.
GVector acosh(const GVector &vector)
Computes acosh of vector elements.
double norm(const GVector &vector)
Computes vector norm.
GVector & operator*=(const double &scalar)
Scalar unary multiplication operator.
GVector sinh(const GVector &vector)
Computes sinh of vector elements.
GVector abs(const GVector &vector)
Computes absolute of vector elements.
GVector cos(const GVector &vector)
Computes cosine of vector elements.
int last_nonzero(void) const
Return the index of the last non-zero element in a vector.
double sum(const GVector &vector)
Computes vector sum.
double acos(const double &arg)
Computes acos by avoiding NaN due to rounding errors.
int first_nonzero(void) const
Return the index of the first non-zero element in a vector.
double min(const GVector &vector)
Computes minimum vector element.
GVector & operator=(const GVector &vector)
Assignment operator.
double & at(const int &index)
Vector element access with range checking.
void clear(void)
Clear vector.
virtual ~GVector(void)
Destructor.
double * m_data
Vector array.
GVector sqrt(const GVector &vector)
Computes square root of vector elements.
GVector tan(const GVector &vector)
Computes tangens of vector elements.
GVector perm(const GVector &vector, const int *p)
Computes vector permutation.
int non_zeros(void) const
Returns number of non-zero elements in vector.
GVector cross(const GVector &a, const GVector &b)
Vector cross product.
bool operator==(const GVector &vector) const
Equality operator.
int m_num
Number of elements in vector.
GVector log(const GVector &vector)
Computes natural logarithm of vector elements.
double angle(const GVector &a, const GVector &b)
Computes angle between vectors.
GVector & operator+=(const GVector &vector)
Unary addition operator.
GArf operator*(const GArf &arf, const double &scale)
Auxiliary Response File scaling operator friend.
Vector class interface definition.
GVector * clone(void) const
Clone vector.
double max(const GVector &vector)
Computes maximum vector element.
GVector asin(const GVector &vector)
Computes arcsin of vector elements.
void init_members(void)
Initialise class members.
GVector operator-(void) const
Unary minus operator.
void copy_members(const GVector &vector)
Copy class members.
GVector tanh(const GVector &vector)
Computes tanh of vector elements.
GVector atanh(const GVector &vector)
Computes atanh of vector elements.
GVector cosh(const GVector &vector)
Computes cosh of vector elements.
GVector asinh(const GVector &vector)
Computes asinh of vector elements.
GVector & operator/=(const double &scalar)
Scalar unary division operator.
GVector(void)
Void vector constructor.
GVector pow(const GVector &vector, const double &power)
Computes tanh of vector elements.
GVector sin(const GVector &vector)
Computes sine of vector elements.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
bool operator!=(const GVector &vector) const
Non-equality operator.
const int & size(void) const
Return size of vector.
GVector iperm(const GVector &vector, const int *p)
Computes vector inverse permutation.
std::string print(const GChatter &chatter=NORMAL) const
Print vector information.
void free_members(void)
Delete class members.
GVector atan(const GVector &vector)
Computes arctan of vector elements.
GVector log10(const GVector &vector)
Computes base10 logarithm of vector elements.
GVector & operator-=(const GVector &vector)
Unary subtraction operator.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.