imate
C++/CUDA Reference
Loading...
Searching...
No Matches
cu_orthogonalization.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3 * SPDX-License-Identifier: BSD-3-Clause
4 * SPDX-FileType: SOURCE
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the license found in the LICENSE.txt file in the root
8 * directory of this source tree.
9 */
10
11
12#ifndef _CU_TRACE_ESTIMATOR_CU_ORTHOGONALIZATION_H_
13#define _CU_TRACE_ESTIMATOR_CU_ORTHOGONALIZATION_H_
14
15// =======
16// Imports
17// =======
18
19#include "../_definitions/types.h" // IndexType, LongIndexType, FlagType
20
21// Avoid CUBLAS numeration value not handled in switch [-Wswitch-enum] warning
22#ifdef _MSC_VER
23 #pragma warning(push, 0) // Suppress all warnings from the followings
24 #include <cublas_v2.h> // cublasHandle_t
25 #pragma warning(pop) // Restore previous warning level
26#elif defined(__INTEL_LLVM_COMPILER) || defined(__INTEL_COMPILER)
27 #pragma warning(push, 0)
28 #include <cublas_v2.h> // cublasHandle_t
29 #pragma warning(pop)
30#elif defined(__GNUC__) || defined(__clang__)
31 #pragma GCC diagnostic push
32 #pragma GCC diagnostic ignored "-Wswitch-enum"
33 #include <cublas_v2.h> // cublasHandle_t
34 #pragma GCC diagnostic pop
35#else
36 #include <cublas_v2.h> // cublasHandle_t
37#endif
38
39
40// ====================
41// cu Orthogonalization
42// ====================
43
51
52template <typename DataType>
54{
55 public:
56
57 // Gram-Schmidt Process
58 static void gram_schmidt_process(
59 cublasHandle_t cublas_handle,
60 const DataType* V,
61 const LongIndexType vector_size,
62 const IndexType num_vectors,
63 const IndexType last_vector,
64 const FlagType num_ortho,
65 DataType* r);
66
67 // Orthogonalize Vectors
68 static void orthogonalize_vectors(
69 cublasHandle_t cublas_handle,
70 DataType* vectors,
71 const LongIndexType vector_size,
72 const IndexType num_vectors);
73};
74
75#endif // _CU_TRACE_ESTIMATOR_CU_ORTHOGONALIZATION_H_
A static class for orthogonalization of vector bases. This class acts as a templated namespace,...
static void gram_schmidt_process(cublasHandle_t cublas_handle, const DataType *V, const LongIndexType vector_size, const IndexType num_vectors, const IndexType last_vector, const FlagType num_ortho, DataType *r)
Modified Gram-Schmidt orthogonalization process to orthogonalize the vector v against a subset of the...
static void orthogonalize_vectors(cublasHandle_t cublas_handle, DataType *vectors, const LongIndexType vector_size, const IndexType num_vectors)
Orthogonalizes set of vectors mutually using modified Gram-Schmidt process.
int LongIndexType
Definition types.h:60
int FlagType
Definition types.h:68
int IndexType
Definition types.h:65