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
 
Vecset (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)
 
Vecoperator= (const Vec &src)
 
Vecapply (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
 

Detailed Description

defines a vector of doubles

Constructor & Destructor Documentation

◆ ~Vec()

~Vec ( )

destructor

Member Function Documentation

◆ create()

void create ( int size)

creates (or resets) vector length and allocated space

create memory for elements of vector

◆ dot()

double dot ( const Vec & a,
const Vec & b )
inlinestatic

returns dot product of a and b

returns the inner (or dot) product of a vector

Parameters
afirst vector
bsecond vector
Returns
(a dot b)

◆ operator=()

Vec & operator= ( const Vec & src)
inline

dst = src