12 #ifndef _C_BASIC_ALGEBRA_C_VECTOR_OPERATIONS_H_
13 #define _C_BASIC_ALGEBRA_C_VECTOR_OPERATIONS_H_
19 #include "../_definitions/types.h"
34 template <
typename DataType>
41 const DataType* input_vector,
43 DataType* output_vector);
47 const DataType* input_vector,
50 DataType* output_vector);
54 const DataType* input_vector,
57 DataType* output_vector);
61 const DataType* vector1,
62 const DataType* vector2,
67 const DataType* vector,
77 const DataType* vector,
79 DataType* output_vector);
A static class for vector operations, similar to level-1 operations of the BLAS library....
static void copy_vector(const DataType *input_vector, const LongIndexType vector_size, DataType *output_vector)
Copies a vector to a new vector. Result is written in-place.
static void copy_scaled_vector(const DataType *input_vector, const LongIndexType vector_size, const DataType scale, DataType *output_vector)
Scales a vector and stores to a new vector.
static void subtract_scaled_vector(const DataType *input_vector, const LongIndexType vector_size, const DataType scale, DataType *output_vector)
Subtracts the scaled input vector from the output vector.
static DataType normalize_vector_in_place(DataType *vector, const LongIndexType vector_size)
Normalizes a vector based on Euclidean 2-norm. The result is written in-place.
static DataType inner_product(const DataType *vector1, const DataType *vector2, const LongIndexType vector_size)
Computes Euclidean inner product of two vectors.
static DataType euclidean_norm(const DataType *vector, const LongIndexType vector_size)
Computes the Euclidean norm of a 1D array.
static DataType normalize_vector_and_copy(const DataType *vector, const LongIndexType vector_size, DataType *output_vector)
Normalizes a vector based on Euclidean 2-norm. The result is written into another vector.