Cosan  1.0
Data Analytics Library
ArgCheck.h
Go to the documentation of this file.
1 #ifndef Arg_CHECK_H
2 #define Arg_CHECK_H
3 
4 // import from other lib
5 #include<string>
6 #include<Eigen/Dense>
7 
8 // import from Cosan
10 
11 /*
12  a collection of utility functions to check the
13  size and type of the given objects
14 */
15 
16 namespace Cosan
17 {
18  /*
19  Check if the two input matrix has the same size
20  Input:
21  m1: a refrence to a CosanMatrix<NumericType> object
22  m2: a refrence to a CosanMatrix<NumericType> object
23  Output:
24  result: bool; true, if they have the same size;
25  false, otherwise
26  */
27  template<typename NumericType,
28  typename = typename std::enable_if<std::is_arithmetic<NumericType>::value,NumericType>::type>
30  {
31  if ((m1.rows() == m2.rows) && (m1.cols() == m2.cols() ) ){
32  return true;}
33  else{
34  return false;}
35  };
36 
37  /*
38  Check if the shape of the input matrix is (n, 1)
39  Input:
40  m1: a refrence to a CosanMatrix<NumericType> object
41  Output:
42  result: bool; true, if it has the shape (n, 1)
43  */
44  template<typename NumericType,
45  typename = typename std::enable_if<std::is_arithmetic<NumericType>::value,NumericType>::type>
47  {
48  if ((m.rows() >= 1) && (m.cols() == 1)) {
49  return true;}
50  else{
51  return false;}
52  }
53 
54 };
55 
56 # endif
CosanData.h
Cosan::LabelShape
bool LabelShape(const CosanMatrix< NumericType > &m)
Definition: ArgCheck.h:46
Cosan
Definition: CosanBO.h:29
NumericType
double NumericType
Definition: onehotencodingTest.cpp:20
Cosan::CosanMatrix
Eigen::Matrix< NumericType, Eigen::Dynamic, Eigen::Dynamic > CosanMatrix
Definition: CosanBO.h:37
Cosan::SameSize
bool SameSize(const CosanMatrix< NumericType > &m1, const CosanMatrix< NumericType > &m2)
Definition: ArgCheck.h:29