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
nmf.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_NMF_HPP
2 #define VIENNACL_LINALG_NMF_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 
27 #include "viennacl/vector.hpp"
28 #include "viennacl/matrix.hpp"
29 #include "viennacl/linalg/prod.hpp"
32 
34 
35 #ifdef VIENNACL_WITH_OPENCL
38 #endif
39 
40 #ifdef VIENNACL_WITH_CUDA
42 #endif
43 
44 namespace viennacl
45 {
46  namespace linalg
47  {
48 
56  template<typename ScalarType>
59  {
60  assert(V.size1() == W.size1() && V.size2() == H.size2() && bool("Dimensions of W and H don't allow for V = W * H"));
61  assert(W.size2() == H.size1() && bool("Dimensions of W and H don't match, prod(W, H) impossible"));
62 
64  {
66  viennacl::linalg::host_based::nmf(V, W, H, conf);
67  break;
68 #ifdef VIENNACL_WITH_OPENCL
71  break;
72 #endif
73 
74 #ifdef VIENNACL_WITH_CUDA
76  viennacl::linalg::cuda::nmf(V,W,H,conf);
77  break;
78 #endif
79 
81  throw memory_exception("not initialised!");
82  default:
83  throw memory_exception("not implemented");
84 
85  }
86 
87  }
88  }
89 }
90 
91 #endif
void nmf(viennacl::matrix_base< NumericT > const &V, viennacl::matrix_base< NumericT > &W, viennacl::matrix_base< NumericT > &H, viennacl::linalg::nmf_config const &conf)
The nonnegative matrix factorization (approximation) algorithm as suggested by Lee and Seung...
Generic interface for the l^2-norm. See viennacl/linalg/vector_operations.hpp for implementations...
Exception class in case of memory errors.
Definition: forwards.h:572
void nmf(viennacl::matrix_base< NumericT > const &V, viennacl::matrix_base< NumericT > &W, viennacl::matrix_base< NumericT > &H, viennacl::linalg::nmf_config const &conf)
The nonnegative matrix factorization (approximation) algorithm as suggested by Lee and Seung...
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
Configuration class for the nonnegative-matrix-factorization algorithm. Specify tolerances, maximum iteration counts, etc., here.
void nmf(viennacl::matrix_base< NumericT > const &V, viennacl::matrix_base< NumericT > &W, viennacl::matrix_base< NumericT > &H, viennacl::linalg::nmf_config const &conf)
The nonnegative matrix factorization (approximation) algorithm as suggested by Lee and Seung...
Generic interface for the Frobenius norm.
size_type size2() const
Returns the number of columns.
Definition: matrix_def.hpp:226
size_type size1() const
Returns the number of rows.
Definition: matrix_def.hpp:224
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
void nmf(viennacl::matrix_base< ScalarType > const &V, viennacl::matrix_base< ScalarType > &W, viennacl::matrix_base< ScalarType > &H, viennacl::linalg::nmf_config const &conf)
The nonnegative matrix factorization (approximation) algorithm as suggested by Lee and Seung...
Definition: nmf.hpp:57
OpenCL kernel file for nonnegative matrix factorization.
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version.
Definition: handle.hpp:41
memory_types get_active_handle_id() const
Returns an ID for the currently active memory buffer. Other memory buffers might contain old or no da...
Definition: mem_handle.hpp:118