ViennaCL - The Vienna Computing Library: viennacl/linalg/detail/bisect/bisect_small.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
bisect_small.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_DETAIL_BISECT_SMALL_HPP_
2 #define VIENNACL_LINALG_DETAIL_BISECT_SMALL_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
30 // includes, system
31 #include <stdlib.h>
32 #include <stdio.h>
33 #include <string.h>
34 #include <math.h>
35 #include <float.h>
36
37 // includes, project
38
39 #include "viennacl/linalg/detail/bisect/structs.hpp"
40
41 // includes, kernels
42 #include "viennacl/linalg/detail/bisect/bisect_kernel_calls.hpp"
43
44 namespace viennacl
45 {
46 namespace linalg
47 {
48 namespace detail
49 {
59 template<typename NumericT>
60 void
61 computeEigenvaluesSmallMatrix(const InputData<NumericT> &input, ResultDataSmall<NumericT> &result,
62 const unsigned int mat_size,
63 const NumericT lg, const NumericT ug,
64 const NumericT precision)
65 {
66 viennacl::linalg::detail::bisectSmall( input, result, mat_size, lg, ug, precision);
67 }
68
69
76 template<typename NumericT>
77 void
78 processResultSmallMatrix(ResultDataSmall<NumericT> &result,
79 const unsigned int mat_size)
80 {
81 // copy data back to host
82 std::vector<NumericT> left(mat_size);
83 std::vector<unsigned int> left_count(mat_size);
84
85 viennacl::copy(result.vcl_g_left, left);
86 viennacl::copy(result.vcl_g_left_count, left_count);
87
88 for (unsigned int i = 0; i < mat_size; ++i)
89 {
90 result.std_eigenvalues[left_count[i]] = left[i];
91 }
92 }
93 } // namespace detail
94 } // namespace linalg
95 } // namespace viennacl
96 #endif
viennacl::linalg::detail::ResultDataSmall::std_eigenvalues
std::vector< NumericT > std_eigenvalues
eigenvalues (host side)
Definition: structs.hpp:99
structs.hpp
Helper structures to simplify variable handling.
bisect_kernel_calls.hpp
Kernel calls for the bisection algorithm.
NumericT
float NumericT
Definition: bisect.cpp:40
viennacl::linalg::detail::InputData
In this class the input matrix is stored.
Definition: structs.hpp:53
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::computeEigenvaluesSmallMatrix
void computeEigenvaluesSmallMatrix(const InputData< NumericT > &input, ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_small.hpp:61
viennacl::linalg::detail::processResultSmallMatrix
void processResultSmallMatrix(ResultDataSmall< NumericT > &result, const unsigned int mat_size)
Definition: bisect_small.hpp:78
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::bisectSmall
void bisectSmall(const InputData< NumericT > &input, ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:59
viennacl::linalg::detail::ResultDataSmall
In this class the data of the result for small matrices is stored.
Definition: structs.hpp:96