So-Bogus
A c++ sparse block matrix library aimed at Second Order cone problems
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Polynomial.hpp
1 /*
2  * This file is part of bogus, a C++ sparse block matrix library.
3  *
4  * Copyright 2013 Gilles Daviet <gdaviet@gmail.com>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
10 
11 
12 #ifndef BOGUS_POLYNOMIAL_HPP
13 #define BOGUS_POLYNOMIAL_HPP
14 
15 namespace bogus
16 {
17 
18 namespace polynomial {
19 
21 enum RealRootsFilter
22 {
23  StrictlyPositiveRoots,
24  StrictlyNegativeRoots,
25  AllRoots
26 } ;
27 
28 template< unsigned Dimension, typename Scalar >
30 {
31  static unsigned getRealRoots( const Scalar* coeffs,
32  Scalar* realRoots,
33  RealRootsFilter filter = AllRoots ) ;
34 } ;
35 
36 template< unsigned Dimension, typename Scalar >
38 {
39  static unsigned getRealRoots( Scalar* coeffs,
40  Scalar* realRoots,
41  RealRootsFilter filter = AllRoots ) ;
42 } ;
43 
45 
50 template< unsigned Dimension, typename Scalar >
51 unsigned getRealRoots( const Scalar (&coeffs)[Dimension],
52  Scalar (&realRoots)[Dimension],
53  RealRootsFilter filter = AllRoots )
54 {
55  return RootsFinder< Dimension, Scalar >::getRealRoots( coeffs, realRoots, filter ) ;
56 }
57 
59 
64 template< unsigned Dimension, typename Scalar >
65 unsigned getRealRoots( Scalar (&coeffs)[Dimension+1],
66  Scalar (&realRoots)[Dimension],
67  RealRootsFilter filter = AllRoots )
68 {
69  return PossiblyDegenerateRootsFinder< Dimension, Scalar >::getRealRoots( coeffs, realRoots, filter ) ;
70 }
71 
72 } //namespace polynomial
73 
74 } //namespace bogus
75 
76 #endif
Definition: Polynomial.hpp:29