DenseVector

template<typename T, Int N>
class DenseVector : public godzilla::DenseMatrix<T, N, 1>

Dense vector with N entries.

Template Parameters:
  • T – Data type of matrix entries

  • N – Number of entries

Public Functions

DenseVector() = default

Create empty vector.

inline explicit DenseVector(const std::vector<T> &a)

Create vector from a std::vector.

Parameters:

a – Values to initialize the vector with

inline const T &get(Int i) const

Get an entry at location (i) for reading.

Parameters:

i – Index

Returns:

Entry at location (i)

inline T &set(Int i)

Get an entry at location (i) for writing.

Parameters:

i – Index

Returns:

Entry at location (i)

inline void add(const DenseVector<T, N> &a)

Add a to this vector, i.e.

vec[i] += a[i]

Parameters:

aVector to add

inline void add(T a)

Add a to each element of this vector, i.e.

vec[i] += a

Parameters:

a – Value to add

inline void subtract(const DenseVector<T, N> &a)

Subtract a from this vector, i.e.

vec[i] -= a[i]

Parameters:

aVector to subtract

inline void normalize()

Normalize this vector.

inline DenseVector<T, N> normalized() const

Compute normalized version of this vector.

Returns:

This vector normalized

inline Real avg() const

Compute average from vector entries.

Returns:

Average of vector entries

inline T sum() const

Sum all vector elements, i.e \Sum_i vec[i].

Returns:

Sum of all elements

inline T magnitude() const

Compute vector magnitude, i.e.

sqrt(\Sum_i vec[i]^2)

Returns:

Vector magnitude

inline T min() const

Find the minimum value of the elements.

Returns:

The minimum value of the elements

inline T max() const

Find the minimum value of the elements.

Returns:

The minimum value of the elements

inline void abs()

Replaces every element in a vector with its absolute value.

DynDenseVector

Warning

doxygenclass: Cannot find class “godzilla::DynDenseVector” in doxygen xml output for project “godzilla” from directory: /home/runner/work/godzilla/godzilla/build/docs/xml/