![]() |
imate
C++/CUDA Reference
|
A static class for vector operations, similar to level-1 operations of the BLAS library. This class acts as a templated namespace, where all member methods are public and static. More...
#include <cu_vector_operations.h>
Static Public Member Functions | |
| static void | copy_vector (cublasHandle_t cublas_handle, const DataType *RESTRICT input_vector, const LongIndexType vector_size, DataType *RESTRICT output_vector) |
| Copies a vector to a new vector. Result is written in-place. | |
| static void | copy_scaled_vector (cublasHandle_t cublas_handle, const DataType *RESTRICT input_vector, const LongIndexType vector_size, const DataType scale, DataType *RESTRICT output_vector) |
| Scales a vector and stores to a new vector. | |
| static void | subtract_scaled_vector (cublasHandle_t cublas_handle, const DataType *RESTRICT input_vector, const LongIndexType vector_size, const DataType scale, DataType *RESTRICT output_vector) |
| Subtracts the scaled input vector from the output vector. | |
| static DataType | inner_product (cublasHandle_t cublas_handle, const DataType *RESTRICT vector1, const DataType *RESTRICT vector2, const LongIndexType vector_size) |
| Computes Euclidean inner product of two vectors. | |
| static DataType | euclidean_norm (cublasHandle_t cublas_handle, const DataType *RESTRICT vector, const LongIndexType vector_size) |
| Computes the Euclidean 2-norm of a 1D array. | |
| static DataType | normalize_vector_in_place (cublasHandle_t cublas_handle, DataType *RESTRICT vector, const LongIndexType vector_size) |
| Normalizes a vector based on Euclidean 2-norm. The result is written in-place. | |
| static DataType | normalize_vector_and_copy (cublasHandle_t cublas_handle, const DataType *RESTRICT vector, const LongIndexType vector_size, DataType *RESTRICT output_vector) |
| Normalizes a vector based on Euclidean 2-norm. The result is written into another vector. | |
A static class for vector operations, similar to level-1 operations of the BLAS library. This class acts as a templated namespace, where all member methods are public and static.
Definition at line 64 of file cu_vector_operations.h.
|
static |
Scales a vector and stores to a new vector.
| [in] | cublas_handle | The cuBLAS object handle. |
| [in] | input_vector | A 1D array |
| [in] | vector_size | Length of vector array |
| [in] | scale | Scale coefficient to the input vector. If this is equal to one, the function effectively becomes the same as copy_vector. |
| [out] | output_vector | Output vector (written in place). |
Definition at line 76 of file cu_vector_operations.cu.
References cublas_api::cublasXcopy(), and cublas_api::cublasXscal().
Referenced by cu_lanczos_tridiagonalization(), and cuVectorOperations< DataType >::normalize_vector_and_copy().


|
static |
Copies a vector to a new vector. Result is written in-place.
| [in] | cublas_handle | The cuBLAS object handle. |
| [in] | input_vector | A 1D array |
| [in] | vector_size | Length of vector array |
| [out] | output_vector | Output vector (written in place). |
Definition at line 41 of file cu_vector_operations.cu.
References cublas_api::cublasXcopy().

|
static |
Computes the Euclidean 2-norm of a 1D array.
| [in] | cublas_handle | The cuBLAS object handle. |
| [in] | vector | A pointer to 1D array |
| [in] | vector_size | Length of the array |
Definition at line 204 of file cu_vector_operations.cu.
References cublas_api::cublasXnrm2().
Referenced by cu_lanczos_tridiagonalization(), cuOrthogonalization< DataType >::gram_schmidt_process(), cuVectorOperations< DataType >::normalize_vector_and_copy(), cuVectorOperations< DataType >::normalize_vector_in_place(), and cuOrthogonalization< DataType >::orthogonalize_vectors().


|
static |
Computes Euclidean inner product of two vectors.
| [in] | cublas_handle | The cuBLAS object handle. |
| [in] | vector1 | 1D array |
| [in] | vector2 | 1D array |
| [in] | vector_size | Length of array |
Definition at line 169 of file cu_vector_operations.cu.
References cublas_api::cublasXdot().
Referenced by cu_lanczos_tridiagonalization(), cuOrthogonalization< DataType >::gram_schmidt_process(), and cuOrthogonalization< DataType >::orthogonalize_vectors().


|
static |
Normalizes a vector based on Euclidean 2-norm. The result is written into another vector.
| [in] | cublas_handle | The cuBLAS object handle. |
| [in] | vector | Input vector. |
| [in] | vector_size | Length of the input vector |
| [out] | output_vector | Output vector, which is the normalization of the input vector. |
Definition at line 278 of file cu_vector_operations.cu.
References cu_arithmetics::abs(), cuVectorOperations< DataType >::copy_scaled_vector(), cu_arithmetics::div(), and cuVectorOperations< DataType >::euclidean_norm().

|
static |
Normalizes a vector based on Euclidean 2-norm. The result is written in-place.
| [in] | cublas_handle | The cuBLAS object handle. |
| [in,out] | vector | Input vector to be normalized in-place. |
| [in] | vector_size | Length of the input vector |
Definition at line 237 of file cu_vector_operations.cu.
References cu_arithmetics::abs(), cublas_api::cublasXscal(), cu_arithmetics::div(), and cuVectorOperations< DataType >::euclidean_norm().
Referenced by cu_golub_kahn_bidiagonalization().


|
static |
Subtracts the scaled input vector from the output vector.
Performs the following operation:
\[ \boldsymbol{b} = \boldsymbol{b} - c \boldsymbol{a}, \]
where
| [in] | cublas_handle | The cuBLAS object handle. |
| [in] | input_vector | A 1D array |
| [in] | vector_size | Length of vector array |
| [in] | scale | Scale coefficient to the input vector. |
| [in,out] | output_vector | Output vector (written in place). |
Definition at line 128 of file cu_vector_operations.cu.
References cublas_api::cublasXaxpy(), and cu_arithmetics::is_equal().
Referenced by cuAffineMatrixFunction< DataType >::_add_scaled_vector(), cu_golub_kahn_bidiagonalization(), cu_lanczos_tridiagonalization(), cuOrthogonalization< DataType >::gram_schmidt_process(), and cuOrthogonalization< DataType >::orthogonalize_vectors().

