Linear Algebra Routines

int32_t danceq::internal::Vector::scale(const T scalar)

Scales the vector by scalar.

Parameters:

scalar – Scalar

Returns:

error_code

int32_t danceq::internal::Vector::add(const Vector<T> &input)

Adds another vector input.

Parameters:

input – Input vector

Returns:

error_code

int32_t danceq::internal::Vector::add_and_scale(const Vector<T> &input, const T scalar)

Adds another vector input that is scaled by scalar.

Parameters:
  • input – Input vector

  • scalar – Scalar to scale the input Input vector

Returns:

error_code

T_real danceq::internal::Vector::get_norm(void) const

Returns the norm.

The norm is returned by the real part of the template parameter T. If T is real T_real and T are identical.

Returns:

norm

Overloaded operators

Vector<T> danceq::internal::Vector::operator+(const Vector<T> &input) const

Overloaded + operator.

Creates a New vector when calling \(C = A + B\).

Parameters:

input – Input vector

Returns:

New vector

Vector<T> danceq::internal::Vector::operator-(const Vector<T> &input) const

Overloaded + operator.

Creates a New vector when calling \(C = A - B\).

Parameters:

input – Input vector

Returns:

New vector

Vector<T> danceq::internal::Vector::operator*(const T scalar) const

Overloaded * operator to scale the vector.

Creates a New vector when calling \(B = s*A\). Here, \(s\) is a scalar.

Parameters:

scalar – Scalar

Returns:

New vector

T danceq::internal::Vector::operator*(const Vector<T> &input) const

Overloaded * operator for the scalar product.

Returns

\[\sum_{i=0}^{\textbf{dim}-1} \texttt{std::conj}(a[i])*b[i]\]

where \(A\) and \(B\) are vectors with entries \(a\) and \(b\), respectively.

Parameters:

input – Input vector

Returns:

inner product