|
Hopsan
|
#include <matrix.h>
Public Member Functions | |
| Vec () | |
| default no-argument constructor | |
| Vec (const Vec &src) | |
| copy constructor | |
| Vec (int size) | |
| constructs a vector of length n | |
| ~Vec () | |
| void | create (int size) |
| creates (or resets) vector length and allocated space | |
| int | length () const |
| returns the length (number of elements) of the vector | |
| void | print () const |
| prints vector contents to stdout | |
| Vec & | set (double v) |
| set to constant value | |
| double & | operator[] (int n) |
| subscript operator (non-const object) | |
| const double & | operator[] (int n) const |
| subscript operator (const object) | |
| Vec & | operator= (const Vec &src) |
| Vec & | apply (V_FCT_PTR fct) |
| applys function fct element-by-element | |
| double | max () |
| returns maximum Vec element | |
| double | min () |
| returns minimum Vec element | |
| double | norm () |
| void | normalize () |
Static Public Member Functions | |
| static double | dot (const Vec &a, const Vec &b) |
| returns dot product of a and b | |
Friends | |
| HOPSANCORE_DLLAPI friend Vec | operator+ (const Vec &a, const Vec &b) |
| returns a+b | |
| Vec HOPSANCORE_DLLAPI | operator- (const Vec &a, const Vec &b) |
| returns a-b | |
| HOPSANCORE_DLLAPI friend Vec | operator* (double c, const Vec &a) |
| returns scalar multiplied by Vec | |
| HOPSANCORE_DLLAPI friend Vec | operator* (const Vec &a, double c) |
| returns Vec multiplied by scalar | |
| HOPSANCORE_DLLAPI friend Vec | operator/ (const Vec &a, double c) |
| returns Vec divided by scalar | |
defines a vector of doubles
| ~Vec | ( | ) |
destructor
| void create | ( | int | size | ) |
creates (or resets) vector length and allocated space
create memory for elements of vector
returns dot product of a and b
returns the inner (or dot) product of a vector
| a | first vector |
| b | second vector |