Polymetic  1.1
A c++ library for polynomial and matrix arithmetic, focused on applications in Kinematics.
 All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Matrix.hpp
Go to the documentation of this file.
1 // Copyright 2018 Dhruvesh Nikhilkumar Patel
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
19 #ifndef _MATRIX_HPP_
20 #define _MATRIX_HPP_
21 #include <boost/numeric/ublas/matrix.hpp>
22 
23 template<typename EntryT>
24 using Matrix = boost::numeric::ublas::matrix<EntryT>;
25 template <typename EntryT>
26 using Identity_Matrix = boost::numeric::ublas::identity_matrix<EntryT>;
27 
28 //template <typename MatrixT>
29 //using productFunctionT = typename boost::numeric::ublas::matrix_matrix_binary_traits<typename MatrixT::value_type, MatrixT, typename MatrixT::value_type, MatrixT>::result_type(*)(const boost::numeric::ublas::matrix_expression<MatrixT>& e1, const boost::numeric::ublas::matrix_expression<MatrixT>& e2);
30 //
33 using boost::numeric::ublas::prod;
34 using boost::numeric::ublas::trans;
35 using boost::numeric::ublas::element_prod;
36 namespace boost { namespace numeric { namespace ublas {
43  template <typename EntryT>
44  EntryT trace(const Matrix<EntryT>& M);
45 
48  template <typename MatrixT>
49  bool isSquare(const MatrixT& M);
50 
51 
52  }
53  }
54 
55 }
56 
57 //template <typename FieldT>
58 //class Matrix
59 //{
60 // public:
61 // /******* Constructors ********/
62 // /*! \brief Takes in no arguments and creates a 0x0 matrix
63 // *
64 // */
65 // Matrix();
66 //
67 // /*! \brief Create a matrix with dimensions num_rows x num_cols with default
68 // * initialized entries.
69 // * \param num_rows
70 // * \param num_cols
71 // */
72 // Matrix(size_t num_rows,size_t num_cols);
73 //
74 // /*! \brief Use 2d initializer list to construct the matrix
75 // *
76 // *
77 // * \param entires 2d initializer list for example, for FieldT=int, {{23,56},{1,100}}
78 // */
79 // Matrix(std::initializer_list<std::initializer_list<FieldT>> entries);
80 //
81 // private:
82 // std::vector<FieldT> m_entries;
83 //};
84 
85 #endif // _MATRIX_HPP_
boost::numeric::ublas::matrix< EntryT > Matrix
Typedef for the main matrix class.
Definition: Matrix.hpp:24
boost::numeric::ublas::identity_matrix< EntryT > Identity_Matrix
Definition: Matrix.hpp:26
EntryT trace(const Matrix< EntryT > &M)
Finds trace of a square matrix.
Definition: Matrix_impl.ipp:25
bool isSquare(const MatrixT &M)
Convinience function to check if a matrix is square or not.
Definition: Matrix_impl.ipp:44