cmake introduction
A short example project for the CMake build system
Public Member Functions | Private Attributes | List of all members
core::Vector< Scalar > Class Template Reference

A vector of arbitrary size. More...

#include <vector.h>

Public Member Functions

 Vector (int _size)
 constructor of a vector of size _size More...
 
virtual ~Vector ()
 destructor, delete memory created during construction More...
 
Scalar & operator() (int i)
 access and change individual elements More...
 
Scalar operator() (int i) const
 access individual element More...
 
int get_size () const
 get the number of entries More...
 
Scalar * get_values ()
 get the array of elements of the vector More...
 
const Scalar * get_values () const
 get the array of elements of the vector More...
 
template<typename OUTPUT_STREAM >
void print_formatted (OUTPUT_STREAM &os, const unsigned int precision=3, const bool scientific=true, const unsigned int width_=0, const char *zero_string="*", const double denominator=1., const double threshold=0.) const
 print the matrix in some nice form More...
 

Private Attributes

int size
 size of vector More...
 
Scalar * values
 the entries of the vector More...
 

Detailed Description

template<typename Scalar>
class core::Vector< Scalar >

A vector of arbitrary size.

The template is typically a double.

Definition at line 18 of file vector.h.

Constructor & Destructor Documentation

◆ Vector()

template<typename Scalar>
core::Vector< Scalar >::Vector ( int  _size)
inline

constructor of a vector of size _size

Parameters
_sizenumber of entries in vector.

Definition at line 23 of file vector.h.

◆ ~Vector()

template<typename Scalar>
virtual core::Vector< Scalar >::~Vector ( )
inlinevirtual

destructor, delete memory created during construction

Definition at line 29 of file vector.h.

Member Function Documentation

◆ get_size()

template<typename Scalar>
int core::Vector< Scalar >::get_size ( ) const
inline

get the number of entries

Definition at line 49 of file vector.h.

◆ get_values() [1/2]

template<typename Scalar>
Scalar* core::Vector< Scalar >::get_values ( )
inline

get the array of elements of the vector

Note
be careful with this. Do not delete it!
use saver const version, if possible

Definition at line 55 of file vector.h.

Here is the caller graph for this function:

◆ get_values() [2/2]

template<typename Scalar>
const Scalar* core::Vector< Scalar >::get_values ( ) const
inline

get the array of elements of the vector

Definition at line 59 of file vector.h.

◆ operator()() [1/2]

template<typename Scalar>
Scalar& core::Vector< Scalar >::operator() ( int  i)
inline

access and change individual elements

The parameter i must be within \([1,\_size]\), otherwise the program terminates with an error.

Definition at line 37 of file vector.h.

◆ operator()() [2/2]

template<typename Scalar>
Scalar core::Vector< Scalar >::operator() ( int  i) const
inline

access individual element

Warning
no checks are done for i.

Definition at line 45 of file vector.h.

◆ print_formatted()

template<typename Scalar>
template<typename OUTPUT_STREAM >
void core::Vector< Scalar >::print_formatted ( OUTPUT_STREAM &  os,
const unsigned int  precision = 3,
const bool  scientific = true,
const unsigned int  width_ = 0,
const char *  zero_string = "*",
const double  denominator = 1.,
const double  threshold = 0. 
) const
inline

print the matrix in some nice form

Parameters
[in,out]osstream to which the matrix is written
Todo:
more documentation, please!

Definition at line 69 of file vector.h.

Here is the caller graph for this function:

Member Data Documentation

◆ size

template<typename Scalar>
int core::Vector< Scalar >::size
private

size of vector

Definition at line 112 of file vector.h.

◆ values

template<typename Scalar>
Scalar* core::Vector< Scalar >::values
private

the entries of the vector

Definition at line 113 of file vector.h.


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