All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bisect_small.hpp
Go to the documentation of this file.
#ifndef VIENNACL_LINALG_DETAIL_BISECT_SMALL_HPP_
#define VIENNACL_LINALG_DETAIL_BISECT_SMALL_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
// includes, system
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <float.h>
// includes, project
#include "viennacl/linalg/detail/bisect/structs.hpp"
// includes, kernels
#include "viennacl/linalg/detail/bisect/bisect_kernel_calls.hpp"
namespace viennacl
{
namespace linalg
{
namespace detail
{
template<typename NumericT>
void
computeEigenvaluesSmallMatrix(const InputData<NumericT> &input, ResultDataSmall<NumericT> &result,
const unsigned int mat_size,
const NumericT lg, const NumericT ug,
const NumericT precision)
{
viennacl::linalg::detail::bisectSmall( input, result, mat_size, lg, ug, precision);
}
template<typename NumericT>
void
processResultSmallMatrix(ResultDataSmall<NumericT> &result,
const unsigned int mat_size)
{
// copy data back to host
std::vector<NumericT> left(mat_size);
std::vector<unsigned int> left_count(mat_size);
viennacl::copy(result.vcl_g_left, left);
viennacl::copy(result.vcl_g_left_count, left_count);
for (unsigned int i = 0; i < mat_size; ++i)
{
result.std_eigenvalues[left_count[i]] = left[i];
}
}
} // namespace detail
} // namespace linalg
} // namespace viennacl
#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