1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
//! Rust wrapper of DACE, the Differential Algebra Computational Toolbox.
//!
//! ## Introduction
//!
//! DACE-RS is a Rust wrapper of DACE, the Differential Algebra Computational Toolbox
//! (<https://github.com/dacelib/dace>).
//!
//! You can find further details on Differential Algebra and its applications
//! on that web page.
//!
//! ## Installation
//!
//! DACE-RS can be used in your project by including it as a Cargo dependency.
//!
//! Add this to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! dace = "0.2"
//! ```
//!
//! If you need to use the `AlgebraicVector<DA>::invert()` function,
//! you need to include `ndarray-linalg` and specify a LAPACK binding
//! (see: <https://github.com/rust-ndarray/ndarray-linalg>).
//!
//! Example:
//!
//! ```toml
//! [dependencies]
//! dace = "0.2"
//! ndarray-linalg = { version = "0.16", features = ["openblas-static"] }
//! ```
//!
//! This is needed also to run tests, e.g.:
//! `cargo test --features=ndarray-linalg/openblas-static`
//!
//! CMake and a C compiler must be installed in the system to build the DACE Core library.
//!
//! ## Tutorials
//!
//! The original DACE C++ tutorials have been translated to Rust
//! and are available in the examples folder:
//! <https://github.com/giovannipurpura/dace-rs/tree/master/examples>
//!
//! ## Examples
//!
//! This is a quick example for basic usage:
//!
//! ```rust
//! use dace::*; // import all DACE elements
//!
//! fn main() {
//! // initialize DACE with order 10 and 3 variables
//! DA::init(10, 3);
//!
//! // assign the three variables to x, y, z -- notice that integers are used here!
//! let (x, y, z): (DA, DA, DA) = (da!(1), da!(2), da!(3));
//! // create also some constants as DA objects -- notice that floats are used here!
//! let (a, b, c): (DA, DA, DA) = (da!(1.0), da!(2.0), da!(3.0));
//!
//! // compute a * sin(x) + b * cos(y) + c * tan(z)
//! let v1: DA = &a * x.sin() + &b * y.cos() + &c * z.tan();
//! // print the resulting DA variable
//! println!("{v1}");
//!
//! // do the same without using the DA constants a, b, c
//! let v2: DA = 1.0 * x.sin() + 2.0 * y.cos() + 3.0 * z.tan();
//! // check that we got the same result
//! println!("v1 == v2: {}", v1 == v2);
//!
//! // try also with AlgebraicVector<DA> and AlgebraicVector<f64>
//! let xyz: AlgebraicVector<DA> = darray![x.sin(), y.cos(), z.tan()];
//! let abc: AlgebraicVector<f64> = darray![1.0, 2.0, 3.0];
//! let v3: DA = xyz.dot(&abc);
//! // check that we got the same result
//! println!("v1 == v3: {}", v1 == v3);
//!
//! // try also with AlgebraicMatrix<DA> and AlgebraicMatrix<f64>
//! let xyz: AlgebraicMatrix<DA> = darray![[x.sin(), y.cos(), z.tan()]];
//! let abc: AlgebraicMatrix<f64> = darray![[1.0], [2.0], [3.0]];
//! let v4: AlgebraicMatrix<DA> = xyz.dot(&abc);
//! // check that we got the same result
//! println!("v1 == v4: {}", v1 == v4[(0, 0)]);
//! }
//! ```
pub use ;
pub use PI;
use ;
pub use Interval;
pub use AlgebraicMatrix;
pub use ;
use ;
static DACE_MAJOR_VERSION: i32 = 2;
static DACE_MINOR_VERSION: i32 = 0;
static DACE_STRLEN: usize = 140;
static INITIALIZED: = new;
/// Truncation order stack
static TO_STACK: = new;
/// Create a DA object.
///
/// Alias of `DA::from(val)`
///
/// Possible arguments and outputs:
/// - u32 -> n-th DA variable
/// - f64 -> DA constant
/// - (u32, f64) -> product of n-th DA variable and constant
/// - &DA -> clone of the DA object
///
/// # Examples
///
/// ```
/// use dace::*;
///
/// // initialize DACE with order 10 and 3 variables
/// DA::init(10, 3);
///
/// let x: DA = da!(1); // first variable
/// let a: DA = da!(3.0); // constant
/// let val = &a * x.sqr(); // 3.0 * x^2
/// let der = val.deriv(1); // derive wrt 1st variable -> 6.0 * x
/// let other = 6.0 * &x; // same, in another way
/// assert_eq!(der, other); // should be equal
/// ```
/// Create an AlgebraicVector or an AlgebraicMatrix.
///
/// # Examples
///
/// ```
/// use dace::*;
///
/// // initialize DACE with order 10 and 3 variables
/// DA::init(10, 3);
///
/// let (x, y, z): (DA, DA, DA) = (da!(1), da!(2), da!(3));
///
/// let xyz: AlgebraicVector<DA> = darray![x.sin(), y.cos(), z.tan()];
/// let abc: AlgebraicVector<f64> = darray![1.0, 2.0, 3.0];
/// let v1: DA = xyz.dot(&abc);
///
/// let xyz: AlgebraicMatrix<DA> = darray![[x.sin(), y.cos(), z.tan()]];
/// let abc: AlgebraicMatrix<f64> = darray![[1.0], [2.0], [3.0]];
/// let v2: AlgebraicMatrix<DA> = xyz.dot(&abc);
///
/// assert_eq!(v1, v2[(0, 0)]);
/// ```
};
=> ;
}