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 *input_vector, const LongIndexType vector_size, DataType *output_vector) |
Copies a vector to a new vector. Result is written in-place. More... | |
static void | copy_scaled_vector (cublasHandle_t cublas_handle, const DataType *input_vector, const LongIndexType vector_size, const DataType scale, DataType *output_vector) |
Scales a vector and stores to a new vector. More... | |
static void | subtract_scaled_vector (cublasHandle_t cublas_handle, const DataType *input_vector, const LongIndexType vector_size, const DataType scale, DataType *output_vector) |
Subtracts the scaled input vector from the output vector. More... | |
static DataType | inner_product (cublasHandle_t cublas_handle, const DataType *vector1, const DataType *vector2, const LongIndexType vector_size) |
Computes Euclidean inner product of two vectors. More... | |
static DataType | euclidean_norm (cublasHandle_t cublas_handle, const DataType *vector, const LongIndexType vector_size) |
Computes the Euclidean 2-norm of a 1D array. More... | |
static DataType | normalize_vector_in_place (cublasHandle_t cublas_handle, DataType *vector, const LongIndexType vector_size) |
Normalizes a vector based on Euclidean 2-norm. The result is written in-place. More... | |
static DataType | normalize_vector_and_copy (cublasHandle_t cublas_handle, 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. More... | |
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 36 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 73 of file cu_vector_operations.cu.
References cublas_interface::cublasXcopy(), and cublas_interface::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 38 of file cu_vector_operations.cu.
References cublas_interface::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 201 of file cu_vector_operations.cu.
References cublas_interface::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 166 of file cu_vector_operations.cu.
References cublas_interface::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 273 of file cu_vector_operations.cu.
References cuVectorOperations< DataType >::copy_scaled_vector(), 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 234 of file cu_vector_operations.cu.
References cublas_interface::cublasXscal(), 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 126 of file cu_vector_operations.cu.
References cublas_interface::cublasXaxpy().
Referenced by cuAffineMatrixFunction< DataType >::_add_scaled_vector(), cu_golub_kahn_bidiagonalization(), cu_lanczos_tridiagonalization(), cuOrthogonalization< DataType >::gram_schmidt_process(), and cuOrthogonalization< DataType >::orthogonalize_vectors().