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
PolynomialMultiplicationInterface_impl.ipp
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 _POLYNOMIALMULTIPLICATIONINTERFACE_IMPL_IPP_
20 #define _POLYNOMIALMULTIPLICATIONINTERFACE_IMPL_IPP_
21 
22 #include "../include/PolynomialMultiplicationInterface.hpp"
23 #include "../include/Polynomial.hpp"
24 #include "../include/PolynomialMultiplicationSimple.hpp"
25 #include <memory>
26 template<typename FieldT>
28 {
29  // chose appropriate algo
30  std::unique_ptr<PolynomialMultiplicationInterface<FieldT>> algo_interface = PolynomialMultiplicationInterface<FieldT>::getAppropriateAlgorithm(p1,p2);
31  return algo_interface->multiply(p1,p2);
32 }
33 
34 template<typename FieldT>
35 std::unique_ptr<PolynomialMultiplicationInterface<FieldT> > PolynomialMultiplicationInterface<FieldT>::getAppropriateAlgorithm( const Polynomial<FieldT>& p1, const Polynomial<FieldT>& p2)
36 {
37  return std::make_unique<PolynomialMultiplicationSimple<FieldT>>();
38 }
39 
40 #endif //_POLYNOMIALMULTIPLICATIONINTERFACE_IPP_
Polynomial< FieldT > operator*(const Polynomial< FieldT > &p1, const Polynomial< FieldT > &p2)
The multiplicaion operator. It picks the algorithm with which the Polynomial class is instantiated...
static std::unique_ptr< PolynomialMultiplicationInterface< FieldT > > getAppropriateAlgorithm(const Polynomial< FieldT > &p1, const Polynomial< FieldT > &p2)
Algo picker.
Contains the definition for the abstract base class which will be used by different multiplication al...
Definition: Polynomial.hpp:40