DACE 2.0 API Manual
Differential Algebra Core Engine
compiledDA.h
Go to the documentation of this file.
1 /******************************************************************************
2 * *
3 * DIFFERENTIAL ALGEBRA CORE ENGINE *
4 * *
5 *******************************************************************************
6 * *
7 * Copyright 2016 Politecnico di Milano (2014 Dinamica Srl) *
8 * Licensed under the Apache License, Version 2.0 (the "License"); *
9 * you may not use this file except in compliance with the License. *
10 * You may obtain a copy of the License at *
11 * *
12 * http://www.apache.org/licenses/LICENSE-2.0 *
13 * *
14 * Unless required by applicable law or agreed to in writing, software *
15 * distributed under the License is distributed on an "AS IS" BASIS, *
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17 * See the License for the specific language governing permissions and *
18 * limitations under the License. *
19 * *
20 *******************************************************************************/
21 
22 /*
23  * compiledDA.h
24  *
25  * Created on: Mar 01, 2014
26  * Author: Dinamica Srl
27  */
28 
29 #ifndef DINAMICA_COMPILEDDA_H_
30 #define DINAMICA_COMPILEDDA_H_
31 
32 // C++ stdlib classes used in this public interface
33 #include <vector>
34 #include <initializer_list>
35 
36 namespace DACE{
37 
38 class DA; // forward declaration
39 
42 {
43 private:
44  double *ac;
45  unsigned int dim;
46  unsigned int ord;
47  unsigned int vars;
48  unsigned int terms;
49 
50 public:
51  /********************************************************************************
52  * Constructors & Destructors
53  *********************************************************************************/
54  compiledDA(const compiledDA &cda);
55  compiledDA(const DA &da);
56  compiledDA(const std::vector<DA> &da);
57  ~compiledDA() throw();
58 
59  /********************************************************************************
60  * Assignments
61  *********************************************************************************/
62  compiledDA& operator=(const compiledDA &cda);
63 
64  /********************************************************************************
65  * Evaluation
66  *********************************************************************************/
67  template<class V> V eval(const V &args) const;
68  template<class T> std::vector<T> eval(const std::initializer_list<T> l) const;
69  template<class T> std::vector<T> eval(const T args[], const unsigned int length) const;
70  template<class T> std::vector<T> evalScalar(const T &arg) const;
71  template<class T> void eval(const std::vector<T> &args, std::vector<T> &res) const;
72 
73  /********************************************************************************
74  * Member access routines
75  *********************************************************************************/
76  const double* getAc() const;
77  unsigned int getDim() const;
78  unsigned int getOrd() const;
79  unsigned int getVars() const;
80  unsigned int getTerms() const;
81 };
82 
83 // specializations for particularly efficient evaluation with double and DA arguments implemented in the library
84 template<> DACE_API void compiledDA::eval(const std::vector<DA> &args, std::vector<DA> &res) const;
85 template<> DACE_API void compiledDA::eval(const std::vector<double> &args, std::vector<double> &res) const;
86 
87 }
88 #endif /* DINAMICA_COMPILEDDA_H_ */
AlgebraicVector< U > evalScalar(const AlgebraicVector< T > &obj, const U &arg)
Definition: DA.h:57
Definition: compiledDA.h:41
V eval(const AlgebraicVector< T > &obj, const V &args)
#define DACE_API
Definition: dace_s.h:33
Definition: AlgebraicMatrix.cpp:39
V eval(const V &args) const
Evaluate the compiled polynomial with a vector of any arithmetic type and return vector of results...
Definition: compiledDA_t.h:40