Class AmiVector

Class Documentation

class amici::AmiVector

AmiVector class provides a generic interface to the NVector_Serial struct

Public Functions

AmiVector() = default

Default constructor.

AmiVector(const long int length)

empty constructor

Creates an std::vector<realtype> and attaches the data pointer to a newly created N_Vector_Serial. Using N_VMake_Serial ensures that the N_Vector module does not try to deallocate the data vector when calling N_VDestroy_Serial

Parameters
  • length: number of elements in vector

AmiVector(std::vector<realtype> rvec)

constructor from std::vector,

Moves data from std::vector and constructs an nvec that points to the data

Parameters
  • rvec: vector from which the data will be moved

AmiVector(gsl::span<realtype> rvec)

constructor from gsl::span,

Copy data from gsl::span and constructs a vector

Parameters
  • rvec: vector from which the data will be copied

AmiVector(const AmiVector &vold)

copy constructor

Parameters
  • vold: vector from which the data will be copied

AmiVector(AmiVector &&other) noexcept

move constructor

Parameters
  • other: vector from which the data will be moved

~AmiVector()

destructor

AmiVector &operator=(AmiVector const &other)

copy assignment operator

Return

left hand side

Parameters
  • other: right hand side

realtype *data()

data accessor

Return

pointer to data array

const realtype *data() const

const data accessor

Return

const pointer to data array

N_Vector getNVector()

N_Vector accessor.

Return

N_Vector

const_N_Vector getNVector() const

N_Vector accessor.

Return

N_Vector

std::vector<realtype> const &getVector() const

Vector accessor.

Return

Vector

int getLength() const

returns the length of the vector

Return

length

void zero()

fills vector with zero values

void minus()

changes the sign of data elements

void set(realtype val)

sets all data elements to a specific value

Parameters
  • val: value for data elements

realtype &operator[](int pos)

accessor to data elements of the vector

Return

element

Parameters
  • pos: index of element

realtype &at(int pos)

accessor to data elements of the vector

Return

element

Parameters
  • pos: index of element

const realtype &at(int pos) const

accessor to data elements of the vector

Return

element

Parameters
  • pos: index of element

void copy(const AmiVector &other)

copies data from another AmiVector

Parameters
  • other: data source