#include <hyb_parameter.h>

Public Member Functions

 Vector (void)
 
 Vector (int dim)
 
 Vector (const Vector &rSrc)
 
 Vector (const std::string &rFileName)
 
virtual ~Vector (void)
 
void Clear (void)
 
Idx Size (void) const
 
int Dimension (void) const
 
void Dimension (int dim)
 
void Zero (int dim=-1)
 
void Ones (int dim=-1)
 
const Scalar::TypeAt (int i) const
 
void At (int i, const Scalar::Type &val)
 
const Scalar::Typeoperator() (int i) const
 
Scalar::Typeoperator() (int i)
 
void CArray (int dim, const Scalar::Type *data)
 
const Scalar::TypeCArray (void) const
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 
 Type (const Type &rType)
 
virtual ~Type (void)
 
virtual TypeNew (void) const
 
virtual TypeCopy (void) const
 
virtual const TypeCast (const Type *pOther) const
 
virtual TypeAssign (const Type &rSrc)
 
Typeoperator= (const Type &rSrc)
 
virtual bool Equal (const Type &rOther) const
 
bool operator== (const Type &rOther) const
 
bool operator!= (const Type &rOther) const
 
virtual void Name (const std::string &rName)
 
virtual const std::string & Name (void) const
 
virtual const std::string & TypeName (void) const
 
void Write (const Type *pContext=0) const
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 
void XWrite (const Type *pContext=0) const
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 
void DWrite (const Type *pContext=0) const
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
void SWrite (TokenWriter &rTw) const
 
void SWrite (void) const
 
std::string ToSText (void) const
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 

Protected Member Functions

virtual VectorDoAssign (const Vector &rSrc)
 
virtual bool DoEqual (const Vector &rOther) const
 
virtual void DoWrite (TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoSWrite (TokenWriter &tw) const
 
virtual void DoRead (TokenReader &tr, const std::string &rLabel="", const Type *pContext=0)
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 
bool DoEqual (const Type &rOther) const
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Protected Attributes

int mDim
 
Scalar::TypempData
 

Detailed Description

Vector of scalars.

This is a wrapper for a plain C array to provide a faudes style interface, incl. token IO, access to individual entries. There is also access to the internal C++ array. Note that libFAUDES does not implement any mathematical operations on vectors. For this purpose, one should employ some external library (e.g. BOOST, alglib, ...) via an appropriate set of wrapper functions.

The token format is as follows:

<Vector count="5">
1.50 -80 17 90 100

Definition at line 391 of file hyb_parameter.h.

Constructor & Destructor Documentation

◆ Vector() [1/4]

Vector::Vector ( void  )

Default constructor - sets dimension to 0

Definition at line 343 of file hyb_parameter.cpp.

◆ Vector() [2/4]

Vector::Vector ( int  dim)

Constructor by dimension

Parameters
dimdimension

Definition at line 350 of file hyb_parameter.cpp.

◆ Vector() [3/4]

Vector::Vector ( const Vector rSrc)

Copy-constructor

Definition at line 366 of file hyb_parameter.cpp.

◆ Vector() [4/4]

Vector::Vector ( const std::string &  rFileName)

Construct from file

Definition at line 374 of file hyb_parameter.cpp.

◆ ~Vector()

Vector::~Vector ( void  )
virtual

Destructor

Definition at line 383 of file hyb_parameter.cpp.

Member Function Documentation

◆ At() [1/2]

const Scalar::Type & Vector::At ( int  i) const

Get entry.

Parameters
iindex.
Returns
entry V(i)
Exceptions
Exception
  • index out of range (id 700);

Definition at line 455 of file hyb_parameter.cpp.

◆ At() [2/2]

void Vector::At ( int  i,
const Scalar::Type val 
)

Set entry.

Parameters
iindex
valvalue
Exceptions
Exception
  • index out of range (id 700);

Definition at line 465 of file hyb_parameter.cpp.

◆ CArray() [1/2]

void Vector::CArray ( int  dim,
const Scalar::Type data 
)

Set from std C array.

This version takes a copy of the provided data.

Parameters
dimdimension
datapointer to array of entries.

Definition at line 497 of file hyb_parameter.cpp.

◆ CArray() [2/2]

const Scalar::Type * Vector::CArray ( void  ) const

Access std C array.

Note that for zero dimension, this function returns NULL.

Returns
Const ref to internal C array

Definition at line 505 of file hyb_parameter.cpp.

◆ Clear()

void Vector::Clear ( void  )
virtual

Clear all.

Sets dimension to 0

Reimplemented from faudes::Type.

Definition at line 410 of file hyb_parameter.cpp.

◆ Dimension() [1/2]

void Vector::Dimension ( int  dim)

Set dimension.

This will invalidate the entries.

Parameters
dimNew dimension

Definition at line 424 of file hyb_parameter.cpp.

◆ Dimension() [2/2]

int Vector::Dimension ( void  ) const

Get dimension.

Returns
Number of entries

Definition at line 435 of file hyb_parameter.cpp.

◆ DoAssign()

Vector & Vector::DoAssign ( const Vector rSrc)
protectedvirtual

Assign from other vector

Parameters
rSrcSource to copy from
Returns
Ref to this vector

Definition at line 389 of file hyb_parameter.cpp.

◆ DoEqual()

bool Vector::DoEqual ( const Vector rOther) const
protectedvirtual

Test equality.

Parameters
rOtherOther object to compare with.
Returns
True on match.

Definition at line 401 of file hyb_parameter.cpp.

◆ DoRead()

void Vector::DoRead ( TokenReader tr,
const std::string &  rLabel = "",
const Type pContext = 0 
)
protectedvirtual

Read from TokenReader, see Type::Read for public wrappers. The method invokes TokenReader::ReadBegin() to seek the specified section, reads subsequent symbols, and calls matching TokenReader::ReadEnd(). If no section is specified, the section is assumed to start at the current position of the token stream. If the current position is no begin token, the section "Vector" is read.

Parameters
trReference to TokenReader
rLabelLabel to read, defaults to current begin label or else "Vector"
pContextWrite context to provide contextual information
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch (id 50)

Reimplemented from faudes::Type.

Definition at line 539 of file hyb_parameter.cpp.

◆ DoSWrite()

void Vector::DoSWrite ( TokenWriter tw) const
protectedvirtual

Write statistic info to TokenWriter, see Type::SWrite for public wrapper.

Parameters
twReference to TokenWriter
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::Type.

Definition at line 532 of file hyb_parameter.cpp.

◆ DoWrite()

void Vector::DoWrite ( TokenWriter tw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
protectedvirtual

Write to TokenWriter, see Type::Write for public wrappers

Parameters
twReference to TokenWriter
rLabelLabel of the section to write, defaults to name of set or "Vector"
pContextWrite context to provide contextual information (ignores)
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::Type.

Definition at line 511 of file hyb_parameter.cpp.

◆ Ones()

void Vector::Ones ( int  dim = -1)

Set to ones.

Either provide dimension, or use the default -1 to maintain the dimension.

Parameters
dimnumber of entries

Definition at line 448 of file hyb_parameter.cpp.

◆ operator()() [1/2]

Scalar::Type & Vector::operator() ( int  i)

Cosmetic access operator.

Parameters
iindex.
Exceptions
Exception
  • index out of range (id 700);

Definition at line 486 of file hyb_parameter.cpp.

◆ operator()() [2/2]

const Scalar::Type & Vector::operator() ( int  i) const

Cosmetic access operator.

Parameters
iindex.
Exceptions
Exception
  • index out of range (id 700);

Definition at line 476 of file hyb_parameter.cpp.

◆ Size()

Idx Vector::Size ( void  ) const

Get size.

Gets over all number of entries. Same as Dimension().

Returns
Dimension()

Definition at line 418 of file hyb_parameter.cpp.

◆ Zero()

void Vector::Zero ( int  dim = -1)

Set to zero vector.

Either provide dimension, or use the default -1 to maintain the dimension.

Parameters
dimnumber of entries

Definition at line 441 of file hyb_parameter.cpp.

Member Data Documentation

◆ mDim

int faudes::Vector::mDim
protected

Definition at line 566 of file hyb_parameter.h.

◆ mpData

Scalar::Type* faudes::Vector::mpData
protected

Definition at line 569 of file hyb_parameter.h.


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

libFAUDES 2.33c --- 2025.05.15 --- c++ api documentaion by doxygen