Template Class Vector

Inheritance Relationships

Base Type

Class Documentation

template<typename TYPE>
class Vector : public opensn::NDArray<TYPE, 1>

Public Functions

inline Vector()

Create an empty dense (column) vector.

inline Vector(unsigned int rows)

Create a dense (column) vector with specified number of rows.

inline Vector(unsigned int rows, TYPE intitial_value)

Create a dense (column) vector with specified number of rows and initialize the elements.

inline Vector(const std::vector<TYPE> &in)
inline unsigned int Rows() const

Return the number of rows.

inline void Resize(unsigned int new_size)

Resize the vector.

inline void Resize(unsigned int new_size, const TYPE &value)

Resize the vector and initialize the new elements with a value.

inline void Set(TYPE val)

Set the elements of the vector to a specified value.

inline void Scale(TYPE alpha)

Scale the vector with a constant value.

inline Vector<TYPE> Scaled(TYPE alpha)

Return this vector scaled.

inline void Normalize()

Normalizes the vector in-place.

inline Vector<TYPE> Normalized() const

Return this vector normalized.

inline TYPE Magnitude() const

Computes the L2-norm of the vector. Otherwise known as the length of a 3D vector.

inline void Add(const Vector<TYPE> &other)
inline void Subtract(const Vector<TYPE> &other)
inline TYPE Dot(const Vector<TYPE> &other)
inline std::string PrintStr() const

Prints the vector to a string and then returns the string.

inline std::vector<TYPE> ToStdVector() const