ViennaCL - The Vienna Computing Library  1.7.0
Free open-source GPU-accelerated linear algebra and solver library.
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-2015, 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 
40 
41 // includes, kernels
43 
44 namespace viennacl
45 {
46 namespace linalg
47 {
48 namespace detail
49 {
59 template<typename NumericT>
60 void
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
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
std::vector< NumericT > std_eigenvalues
eigenvalues (host side)
Definition: structs.hpp:99
Helper structures to simplify variable handling.
Kernel calls for the bisection algorithm.
float NumericT
Definition: bisect.cpp:40
Main namespace in ViennaCL. Holds all the basic types such as vector, matrix, etc. and defines operations upon them.
Definition: cpu_ram.hpp:34
In this class the input matrix is stored.
Definition: structs.hpp:53
Definition: blas3.hpp:36
viennacl::vector< NumericT > vcl_g_left
left interval limits at the end of the computation
Definition: structs.hpp:101
viennacl::vector< unsigned int > vcl_g_left_count
number of eigenvalues smaller than the left interval limit
Definition: structs.hpp:105
void computeEigenvaluesSmallMatrix(const InputData< NumericT > &input, ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
void processResultSmallMatrix(ResultDataSmall< NumericT > &result, const unsigned int mat_size)
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) ...
void bisectSmall(const InputData< NumericT > &input, ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
In this class the data of the result for small matrices is stored.
Definition: structs.hpp:96