DenseVector
-
template<typename T, Int N>
class DenseVector : public godzilla::DenseMatrix<T, N, 1> Dense vector with
Nentries.- 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
ato this vector, i.e.vec[i] += a[i]
- Parameters:
a – Vector to add
-
inline void add(T a)
Add
ato each element of this vector, i.e.vec[i] += a
- Parameters:
a – Value to add
-
inline void subtract(const DenseVector<T, N> &a)
Subtract
afrom this vector, i.e.vec[i] -= a[i]
- Parameters:
a – Vector 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 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/