MachineIntelligenceCore:Algorithms
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MatrixXfSpecializations.hpp
Go to the documentation of this file.
1 
23 #ifndef SRC_TYPES_MATRIXXFSPECIALIZATIONS_HPP_
24 #define SRC_TYPES_MATRIXXFSPECIALIZATIONS_HPP_
25 
26 #include <types/Matrix.hpp>
27 
28 //#include <types/Pair.hpp>
29 
30 
31 #ifdef OpenBLAS_FOUND
32 #include <cblas.h>
33 #endif
34 
35 namespace mic {
36 namespace types {
37 
42 template<>
44  const Eigen::MatrixXf & mat_) {
45 
46 #ifdef OpenBLAS_FOUND
47  // Using openBLAS boost!
48  //printf("Using specialized (float) BLAS boost!\n");
49  // Get dimensions.
50  size_t M = this->rows();
51  size_t K = this->cols();
52  size_t N = mat_.cols();
53  // Create temporary matrix.
54  Eigen::MatrixXf c(M,N);
55 
56  cblas_sgemm( CblasColMajor, CblasNoTrans, CblasNoTrans, M, N, K, 1.0,
57  this->data(), M,
58  mat_.data(), K, 0.0, c.data(), M );
59  return c;
60 #else
61  // Calling base EIGEN operator *
62  //printf("Calling specialized (float) base EIGEN operator *\n");
63  return Eigen::MatrixXf::operator*(mat_);
64 #endif
65 }
66 
67 
73 
74 
79 typedef std::shared_ptr< Eigen::VectorXf >VectorXfPtr;
80 
81 
87 
88 
93 typedef std::shared_ptr< mic::types::MatrixXf > MatrixXfPtr;
94 
95 
100 typedef std::pair< MatrixXfPtr, std::shared_ptr<char> > MatrixXfCharPair;
101 
106 typedef std::pair< MatrixXfPtr, std::shared_ptr<unsigned int> > MatrixXfUintPair;
107 
112 typedef std::pair< MatrixXfPtr, MatrixXfPtr > MatrixXfMatrixXfPair;
113 
114 
115 }//: namespace types
116 }//: namespace mic
117 
118 
119 
120 #endif /* SRC_TYPES_MATRIXXFSPECIALIZATIONS_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
Eigen::VectorXf VectorXf
Vector of floats with single precision (of dynamic size).
std::shared_ptr< mic::types::MatrixXf > MatrixXfPtr
Shared pointer to matrix with single precision floats (of dynamic size).
std::pair< MatrixXfPtr, std::shared_ptr< char > > MatrixXfCharPair
The <single precision="" float="" matrix-char>=""> pair type.
std::shared_ptr< Eigen::VectorXf > VectorXfPtr
Shared pointer to vector of floats with single precision (of dynamic size).
std::pair< MatrixXfPtr, MatrixXfPtr > MatrixXfMatrixXfPair
The <single precision float matrix - single precision float matrix> pair.
mic::types::Matrix< float > MatrixXf
Matrix of floats with single precision (of dynamic size).
std::pair< MatrixXfPtr, std::shared_ptr< unsigned int > > MatrixXfUintPair
The <single precision="" float="" matrix-unsigned="" int>=""> pair.
Template-typed Matrix of dynamic size. Uses OpenBLAS if found by CMAKE - overloaded, specializations of * operator for types: float, double.
Definition: Matrix.hpp:64