MachineIntelligenceCore:Algorithms
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MatrixXdSpecializations.hpp
Go to the documentation of this file.
1 
23 #ifndef SRC_TYPES_MATRIXXDSPECIALIZATIONS_HPP_
24 #define SRC_TYPES_MATRIXXDSPECIALIZATIONS_HPP_
25 
26 #include <types/Matrix.hpp>
27 
28 #ifdef OpenBLAS_FOUND
29 #include <cblas.h>
30 #endif
31 
32 namespace mic {
33 namespace types {
34 
39 template<>
41 
42 #ifdef OpenBLAS_FOUND
43  // Using openBLAS boost!
44  //printf("Using specialized (double) BLAS boost!\n");
45  // Get dimensions.
46  size_t M = this->rows();
47  size_t K = this->cols();
48  size_t N = mat_.cols();
49  // Create temporary matrix.
50  Eigen::MatrixXd c(M,N);
51 
52  cblas_dgemm( CblasColMajor, CblasNoTrans, CblasNoTrans, M, N, K, 1.0,
53  this->data(), M,
54  mat_.data(), K, 0.0, c.data(), M );
55  return c;
56 #else
57  // Calling base EIGEN operator *
58  //printf("Calling specialized (double) base EIGEN operator *\n");
59  return Eigen::MatrixXd::operator*(mat_);
60 #endif
61 }
62 
63 
69 
70 
76 
77 
82 typedef std::shared_ptr< mic::types::MatrixXd > MatrixXdPtr;
83 
84 
89 typedef std::pair< MatrixXdPtr, std::shared_ptr<char> > MatrixXdCharPair;
90 
95 typedef std::pair< MatrixXdPtr, std::shared_ptr<unsigned int> > MatrixXdUintPair;
96 
97 
98 }//: namespace types
99 }//: namespace mic
100 
101 
102 
103 #endif /* SRC_TYPES_MATRIXXDSPECIALIZATIONS_HPP_ */
EIGEN_STRONG_INLINE Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > operator*(const Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > &mat_)
Definition: Matrix.hpp:162
std::pair< MatrixXdPtr, std::shared_ptr< unsigned int > > MatrixXdUintPair
The <matrix-unsigned int> pair type used by e.g. MNISTMatrixImporter.
std::pair< MatrixXdPtr, std::shared_ptr< char > > MatrixXdCharPair
The <matrix-char> pair type used by e.g. IBMFontMatrixImporter.
Eigen::VectorXd VectorXd
Vector of double precision floats (of dynamic size).
std::shared_ptr< mic::types::MatrixXd > MatrixXdPtr
Shared pointer to matrix of double precision floats (of dynamic size).
mic::types::Matrix< double > MatrixXd
Matrix of double precision floats (of dynamic size).
Template-typed Matrix of dynamic size. Uses OpenBLAS if found by CMAKE - overloaded, specializations of * operator for types: float, double.
Definition: Matrix.hpp:64