ViennaCL - The Vienna Computing Library: viennacl/linalg/detail/bisect/structs.hpp Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
structs.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_DETAIL_BISECT_STRUCTS_HPP_
2 #define VIENNACL_LINALG_DETAIL_BISECT_STRUCTS_HPP_
3
4 /* =========================================================================
5 Copyright (c) 2010-2016, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8 Portions of this software are copyright by UChicago Argonne, LLC.
9
10 -----------------
11 ViennaCL - The Vienna Computing Library
12 -----------------
13
14 Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15
16 (A list of authors and contributors can be found in the manual)
17
18 License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20
21
32 #include <stdlib.h>
33 #include <stdio.h>
34 #include <string.h>
35 #include <math.h>
36 #include <float.h>
37 #include <assert.h>
38
39 #include "viennacl/vector.hpp"
40 #include "viennacl/matrix.hpp"
41
42 namespace viennacl
43 {
44 namespace linalg
45 {
46 namespace detail
47 {
48
52 template<typename NumericT>
53 struct InputData
54 {
56 std::vector<NumericT> std_a;
58 std::vector<NumericT> std_b;
60 viennacl::vector<NumericT> g_a;
62 viennacl::vector<NumericT> g_b;
63
70 InputData(std::vector<NumericT> diagonal, std::vector<NumericT> superdiagonal, const unsigned int sz) :
71 std_a(sz), std_b(sz), g_a(sz), g_b(sz)
72 {
73 std_a = diagonal;
74 std_b = superdiagonal;
75
76 viennacl::copy(std_b, g_b);
77 viennacl::copy(std_a, g_a);
78 }
79
80 InputData(viennacl::vector<NumericT> diagonal, viennacl::vector<NumericT> superdiagonal, const unsigned int sz) :
81 std_a(sz), std_b(sz), g_a(sz), g_b(sz)
82 {
83 g_a = diagonal;
84 g_b = superdiagonal;
85
86 viennacl::copy(g_a, std_a);
87 viennacl::copy(g_b, std_b);
88 }
89 };
90
91
95 template<typename NumericT>
96 struct ResultDataSmall
97 {
99 std::vector<NumericT> std_eigenvalues;
101 viennacl::vector<NumericT> vcl_g_left;
103 viennacl::vector<NumericT> vcl_g_right;
105 viennacl::vector<unsigned int> vcl_g_left_count;
107 viennacl::vector<unsigned int> vcl_g_right_count;
108
109
113 ResultDataSmall(const unsigned int mat_size) :
114 std_eigenvalues(mat_size), vcl_g_left(mat_size), vcl_g_right(mat_size), vcl_g_left_count(mat_size), vcl_g_right_count(mat_size) {}
115 };
116
117
118
119
120
124 template<typename NumericT>
125 struct ResultDataLarge
126 {
128 std::vector<NumericT> std_eigenvalues;
129
131 viennacl::scalar<unsigned int> g_num_one;
132
134 viennacl::scalar<unsigned int> g_num_blocks_mult;
135
137 viennacl::vector<NumericT> g_left_one;
138
140 viennacl::vector<NumericT> g_right_one;
141
143 viennacl::vector<unsigned int> g_pos_one;
144
146 viennacl::vector<NumericT> g_left_mult;
148 viennacl::vector<NumericT> g_right_mult;
149
151 viennacl::vector<unsigned int> g_left_count_mult;
152
154 viennacl::vector<unsigned int> g_right_count_mult;
156 viennacl::vector<unsigned int> g_blocks_mult;
157
159 viennacl::vector<unsigned int> g_blocks_mult_sum;
160
162 viennacl::vector<NumericT> g_lambda_mult;
163
165 viennacl::vector<unsigned int> g_pos_mult;
166
171 ResultDataLarge(unsigned int mat_size) :
172 std_eigenvalues(mat_size), g_num_one(0), g_num_blocks_mult(0),
173 g_left_one(mat_size), g_right_one(mat_size), g_pos_one(mat_size),
174 g_left_mult(mat_size), g_right_mult(mat_size), g_left_count_mult(mat_size), g_right_count_mult(mat_size),
175 g_blocks_mult(mat_size), g_blocks_mult_sum(mat_size), g_lambda_mult(mat_size), g_pos_mult(mat_size) {}
176
177 };
178 } // namespace detail
179 } // namespace linalg
180 } // namespace viennacl
181 #endif // #ifndef VIENNACL_LINALG_DETAIL_STRUCTS_HPP_
182
viennacl::linalg::detail::InputData::g_b
viennacl::vector< NumericT > g_b
device side representation of superdiagonal
Definition: structs.hpp:62
viennacl::linalg::detail::ResultDataSmall::std_eigenvalues
std::vector< NumericT > std_eigenvalues
eigenvalues (host side)
Definition: structs.hpp:99
viennacl::scalar< unsigned int >
viennacl::linalg::detail::ResultDataLarge::g_left_mult
viennacl::vector< NumericT > g_left_mult
left interval limits of intervals containing multiple eigenvalues after the first iteration step ...
Definition: structs.hpp:146
viennacl::linalg::detail::InputData::InputData
InputData(viennacl::vector< NumericT > diagonal, viennacl::vector< NumericT > superdiagonal, const unsigned int sz)
Definition: structs.hpp:80
viennacl::linalg::detail::ResultDataLarge::g_left_one
viennacl::vector< NumericT > g_left_one
left interval limits of intervals containing one eigenvalue after the first iteration step ...
Definition: structs.hpp:137
matrix.hpp
Implementation of the dense matrix class.
viennacl::linalg::detail::ResultDataLarge::g_num_blocks_mult
viennacl::scalar< unsigned int > g_num_blocks_mult
number of (thread) blocks of intervals containing multiple eigenvalues after the first steo ...
Definition: structs.hpp:134
viennacl::linalg::detail::ResultDataLarge::g_blocks_mult
viennacl::vector< unsigned int > g_blocks_mult
start addresses in g_left_mult etc. of blocks of intervals containing more than one eigenvalue after ...
Definition: structs.hpp:156
viennacl::linalg::detail::InputData::std_a
std::vector< NumericT > std_a
host side representation of diagonal
Definition: structs.hpp:56
viennacl::linalg::detail::ResultDataLarge::g_left_count_mult
viennacl::vector< unsigned int > g_left_count_mult
number of eigenvalues less than the left limit of the eigenvalue intervals containing multiple eigenv...
Definition: structs.hpp:151
viennacl::linalg::detail::ResultDataLarge::g_right_count_mult
viennacl::vector< unsigned int > g_right_count_mult
number of eigenvalues less than the right limit of the eigenvalue intervals containing multiple eigen...
Definition: structs.hpp:154
viennacl::linalg::detail::InputData
In this class the input matrix is stored.
Definition: structs.hpp:53
viennacl::linalg::detail::ResultDataSmall::ResultDataSmall
ResultDataSmall(const unsigned int mat_size)
Initialize variables and memory for the result for small matrices.
Definition: structs.hpp:113
viennacl::linalg::detail::ResultDataSmall::vcl_g_right
viennacl::vector< NumericT > vcl_g_right
right interval limits at the end of the computation
Definition: structs.hpp:103
viennacl::linalg::detail::ResultDataLarge::g_lambda_mult
viennacl::vector< NumericT > g_lambda_mult
eigenvalues that have been generated in the second step from intervals that still contained multiple ...
Definition: structs.hpp:162
viennacl::linalg::detail::ResultDataSmall::vcl_g_left
viennacl::vector< NumericT > vcl_g_left
left interval limits at the end of the computation
Definition: structs.hpp:101
viennacl::linalg::detail::ResultDataSmall::vcl_g_left_count
viennacl::vector< unsigned int > vcl_g_left_count
number of eigenvalues smaller than the left interval limit
Definition: structs.hpp:105
viennacl::linalg::detail::ResultDataLarge::g_pos_one
viennacl::vector< unsigned int > g_pos_one
interval indices (position in sorted listed of eigenvalues) of intervals containing one eigenvalue af...
Definition: structs.hpp:143
viennacl::linalg::detail::ResultDataLarge::std_eigenvalues
std::vector< NumericT > std_eigenvalues
eigenvalues
Definition: structs.hpp:128
viennacl::vector< NumericT >
viennacl::linalg::detail::InputData::InputData
InputData(std::vector< NumericT > diagonal, std::vector< NumericT > superdiagonal, const unsigned int sz)
Initialize the input data to the algorithm.
Definition: structs.hpp:70
viennacl::linalg::detail::ResultDataLarge::g_right_one
viennacl::vector< NumericT > g_right_one
right interval limits of intervals containing one eigenvalue after the first iteration step ...
Definition: structs.hpp:140
vector.hpp
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
viennacl::linalg::detail::ResultDataLarge::g_pos_mult
viennacl::vector< unsigned int > g_pos_mult
eigenvalue index of intervals that have been generated in the second processing step ...
Definition: structs.hpp:165
viennacl::copy
void copy(std::vector< NumericT > &cpu_vec, circulant_matrix< NumericT, AlignmentV > &gpu_mat)
Copies a circulant matrix from the std::vector to the OpenCL device (either GPU or multi-core CPU) ...
Definition: circulant_matrix.hpp:150
viennacl::linalg::detail::ResultDataLarge::ResultDataLarge
ResultDataLarge(unsigned int mat_size)
Initialize variables and memory for result.
Definition: structs.hpp:171
viennacl::linalg::detail::ResultDataSmall::vcl_g_right_count
viennacl::vector< unsigned int > vcl_g_right_count
number of eigenvalues bigger than the right interval limit
Definition: structs.hpp:107
viennacl::linalg::detail::ResultDataLarge
In this class the data of the result for large matrices is stored.
Definition: structs.hpp:125
viennacl::linalg::detail::ResultDataLarge::g_blocks_mult_sum
viennacl::vector< unsigned int > g_blocks_mult_sum
accumulated number of intervals in g_left_mult etc. of blocks of intervals containing more than one e...
Definition: structs.hpp:159
viennacl::linalg::detail::ResultDataLarge::g_num_one
viennacl::scalar< unsigned int > g_num_one
number of intervals containing one eigenvalue after the first step
Definition: structs.hpp:131
viennacl::linalg::detail::InputData::std_b
std::vector< NumericT > std_b
host side representation superdiagonal
Definition: structs.hpp:58
viennacl::linalg::detail::ResultDataSmall
In this class the data of the result for small matrices is stored.
Definition: structs.hpp:96
viennacl::linalg::detail::InputData::g_a
viennacl::vector< NumericT > g_a
device side representation of diagonal
Definition: structs.hpp:60
viennacl::linalg::detail::ResultDataLarge::g_right_mult
viennacl::vector< NumericT > g_right_mult
right interval limits of intervals containing multiple eigenvalues after the first iteration step ...
Definition: structs.hpp:148