MUQ  0.4.3
AnyAlgebra.cpp
Go to the documentation of this file.
2 
3 using namespace muq::Modeling;
4 
6 
7 unsigned int AnyAlgebra::Size(boost::any const& obj, int const dim) const {
8  // scalars are size one
9  if( ScalarAlgebra::IsScalar(obj.type()) ) { return 1; }
10 
11  // get the size of an Eigen::VectorXd
12  if( EigenVectorAlgebra::IsEigenVector(obj.type()) ) { return EigenVectorAlgebra::Size(obj); }
13 
14  // get the size of an Eigen::MatrixXd
15  if( EigenMatrixAlgebra::IsEigenMatrix(obj.type()) ) { return EigenMatrixAlgebra::Size(obj, dim); }
16 
17  // get the size of Sundials vectors
18 #if MUQ_HAS_SUNDIALS==1
19  if( SundialsAlgebra::IsSundialsVector(obj.type()) ) { return SundialsAlgebra::Size(obj); }
20 #endif
21 
22  return SizeImpl(obj);
23 }
24 
25 unsigned int AnyAlgebra::SizeImpl(boost::any const& obj) const {
26  std::cerr << std::endl << "ERROR: cannot compute the size of an object with type " << boost::core::demangle(obj.type().name()) << std::endl;
27  std::cerr << "\tTry overloading boost::any AnyAlgebra::SizeImpl()" << std::endl << std::endl;
28  std::cerr << "\tError in AnyAlgebra::SizeImpl()" << std::endl << std::endl;
29 
30  return 0;
31 }
32 
33 boost::any AnyAlgebra::Zero(std::type_info const& type, unsigned int rows, unsigned int const cols) const {
34  if( ScalarAlgebra::IsScalar(type) ) { return ScalarAlgebra::Zero(type); }
35 
36  if( EigenVectorAlgebra::IsEigenVector(type) ) { return EigenVectorAlgebra::Zero(type, rows); }
37 
38  if( EigenMatrixAlgebra::IsEigenMatrix(type) ) { return EigenMatrixAlgebra::Zero(type, rows, cols); }
39 
40  if( type==typeid(double) ) {
41  return 0.0;
42  }
43 
44  return ZeroImpl(type, rows, cols);
45 }
46 
47 boost::any AnyAlgebra::ZeroImpl(std::type_info const& type, unsigned int const rows, unsigned int const cols) const {
48  std::cerr << std::endl << "ERROR: cannot compute zero of an object with type " << boost::core::demangle(type.name()) << std::endl;
49  std::cerr << "\tTry overloading boost::any AnyAlgebra::ZeroImpl()" << std::endl << std::endl;
50  std::cerr << "\tError in AnyAlgebra::ZeroImpl()" << std::endl << std::endl;
51 
52  return boost::none;
53 }
54 
55 double AnyAlgebra::Norm(boost::any const& obj) const {
56  if( ScalarAlgebra::IsScalar(obj.type()) ) { return ScalarAlgebra::Norm(obj); }
57 
58  if( EigenVectorAlgebra::IsEigenVector(obj.type()) ) { return EigenVectorAlgebra::Norm(obj); }
59 
60  if( EigenMatrixAlgebra::IsEigenMatrix(obj.type()) ) { return EigenMatrixAlgebra::Norm(obj); }
61 
62  return NormImpl(obj);
63 }
64 
65 double AnyAlgebra::NormImpl(boost::any const& obj) const {
66  std::cerr << std::endl << "ERROR: Cannot compute the norm of an object with type " << boost::core::demangle(obj.type().name()) << std::endl;
67  std::cerr << "\tTry overloading boost::any AnyAlgebra::NormImpl()" << std::endl << std::endl;
68  std::cerr << "\tError in AnyAlgebra::NormImpl()" << std::endl << std::endl;
69 
70  return -1.0;
71 }
72 
73 double AnyAlgebra::InnerProduct(boost::any const& vec1, boost::any const& vec2) const {
74  if( ScalarAlgebra::IsScalar(vec1.type()) && ScalarAlgebra::IsScalar(vec2.type()) ) { return ScalarAlgebra::InnerProduct(vec1, vec2); }
75 
76  if( EigenVectorAlgebra::IsEigenVector(vec1.type()) && EigenVectorAlgebra::IsEigenVector(vec2.type()) ) { return EigenVectorAlgebra::InnerProduct(vec1, vec2); }
77 
78  return InnerProductImpl(vec1, vec2);
79 }
80 
81 double AnyAlgebra::InnerProductImpl(boost::any const& vec1, boost::any const& vec2) const {
82  std::cerr << std::endl << "ERROR: Cannot compute the inner product between vectors with types " << boost::core::demangle(vec1.type().name()) << " and " << boost::core::demangle(vec2.type().name()) << std::endl;
83  std::cerr << "\tTry overloading boost::any AnyAlgebra::InnerProductImpl()" << std::endl << std::endl;
84  std::cerr << "\tError in AnyAlgebra::InnerProductImpl()" << std::endl << std::endl;
85 
86  return 0.0;
87 }
88 
89 boost::any AnyAlgebra::OuterProduct(boost::any const& vec1, boost::any const& vec2) const {
90  if( ScalarAlgebra::IsScalar(vec1.type()) && ScalarAlgebra::IsScalar(vec2.type()) ) {
91  return ScalarAlgebra::OuterProduct(vec1, vec2); }
92 
93  if( EigenVectorAlgebra::IsEigenVector(vec1.type()) && EigenVectorAlgebra::IsEigenVector(vec2.type()) ) { return EigenVectorAlgebra::OuterProduct(vec1, vec2); }
94 
95  return OuterProductImpl(vec1, vec2);
96 }
97 
98 boost::any AnyAlgebra::OuterProductImpl(boost::any const& vec1, boost::any const& vec2) const {
99  std::cerr << std::endl << "ERROR: Cannot compute the outer product between vectors with types " << boost::core::demangle(vec1.type().name()) << " and " << boost::core::demangle(vec2.type().name()) << std::endl;
100  std::cerr << "\tTry overloading boost::any AnyAlgebra::OuterProductImpl()" << std::endl << std::endl;
101  std::cerr << "\tError in AnyAlgebra::OuterProductImpl()" << std::endl << std::endl;
102 
103  return boost::none;
104 }
105 
106 bool AnyAlgebra::IsZero(boost::any const& obj) const {
107  if( ScalarAlgebra::IsScalar(obj.type()) ) { return ScalarAlgebra::IsZero(obj); }
108 
109  if( EigenVectorAlgebra::IsEigenVector(obj.type()) ) { return EigenVectorAlgebra::IsZero(obj); }
110 
111  if( EigenMatrixAlgebra::IsEigenMatrix(obj.type()) ) { return EigenMatrixAlgebra::IsZero(obj); }
112 
113  return IsZeroImpl(obj);
114 }
115 
116 bool AnyAlgebra::IsZeroImpl(boost::any const& obj) const {
117  std::cerr << std::endl << "ERROR: No way to determine if an object with type " << boost::core::demangle(obj.type().name()) << " is the zero vector." << std::endl;
118  std::cerr << "\tTry overloading boost::any AnyAlgebra::IsZero()" << std::endl << std::endl;
119  std::cerr << "\tError in AnyAlgebra::IsZero()" << std::endl << std::endl;
120 
121  return false;
122 }
123 
124 boost::any AnyAlgebra::AccessElement(boost::any const& obj, unsigned int const i, unsigned int const j) const {
125  if( ScalarAlgebra::IsScalar(obj.type()) ) { return obj; }
126 
127  if( EigenVectorAlgebra::IsEigenVector(obj.type()) ) { return EigenVectorAlgebra::AccessElement(obj, i); }
128 
129  if( EigenMatrixAlgebra::IsEigenMatrix(obj.type()) ) { return EigenMatrixAlgebra::AccessElement(obj, i, j); }
130 
131 #if MUQ_HAS_SUNDIALS==1
132  if( SundialsAlgebra::IsSundialsVector(obj.type()) ) { return SundialsAlgebra::AccessElement(boost::any_cast<const N_Vector&>(obj), i); }
133 #endif
134 
135  return AccessElementImpl(obj, i);
136 }
137 
138 boost::any AnyAlgebra::AccessElementImpl(boost::any const& vec, unsigned int const i) const {
139  std::cerr << std::endl << "ERROR: No way to access element " << i << " of a vector with type " << boost::core::demangle(vec.type().name()) << std::endl;
140  std::cerr << "\tTry overloading boost::any AnyAlgebra::AccessElement()" << std::endl << std::endl;
141  std::cerr << "\tError in AnyAlgebra::AccessElement()" << std::endl << std::endl;
142 
143  return boost::none;
144 }
145 
146 boost::any AnyAlgebra::Identity(std::type_info const& type, unsigned int const rows, unsigned int const cols) const {
147  if( ScalarAlgebra::IsScalar(type) ) { return ScalarAlgebra::Identity(type); }
148 
149  if( EigenVectorAlgebra::IsEigenVector(type) ) { return EigenVectorAlgebra::Identity(type, rows, cols); }
150 
151  if( EigenMatrixAlgebra::IsEigenMatrix(type) ) { return EigenMatrixAlgebra::Identity(type, rows, cols); }
152 
153  return IdentityImpl(type, rows, cols);
154 }
155 
156 boost::any AnyAlgebra::IdentityImpl(std::type_info const& type, unsigned int const rows, unsigned int const cols) const {
157  std::cerr << std::endl << "ERROR: No way to compute identy object with type " << boost::core::demangle(type.name()) << std::endl;
158  std::cerr << "\tTry overloading boost::any AnyAlgebra::IdentityImpl()" << std::endl << std::endl;
159  std::cerr << "\tError in AnyAlgebra::IdentityImpl()" << std::endl << std::endl;
160 
161  return boost::none;
162 }
163 
164 boost::any AnyAlgebra::Add(boost::any const& in0, boost::any const& in1) const {
165  // the first type is boost::none --- return the second
166  if( in0.type()==typeid(boost::none) ) { return in1; }
167 
168  // the second type is boost::none --- return the first
169  if( in1.type()==typeid(boost::none) ) { return in0; }
170 
171  if( ScalarAlgebra::IsScalar(in0.type()) && ScalarAlgebra::IsScalar(in1.type()) ) { return ScalarAlgebra::Add(in0, in1); }
172 
173  if( EigenVectorAlgebra::IsEigenVector(in0.type()) && EigenVectorAlgebra::IsEigenVector(in1.type()) ) { return EigenVectorAlgebra::Add(in0, in1); }
174 
175  if( EigenMatrixAlgebra::IsEigenMatrix(in0.type()) || EigenMatrixAlgebra::IsEigenMatrix(in1.type()) ) { return EigenMatrixAlgebra::Add(in0, in1); }
176 
177  return AddImpl(in0, in1);
178 }
179 
180 boost::any AnyAlgebra::AddImpl(boost::any const& in0, boost::any const& in1) const {
181  std::cerr << std::endl << "ERROR: No way to add type " << boost::core::demangle(in0.type().name()) << " and type " << boost::core::demangle(in1.type().name()) << std::endl;
182  std::cerr << "\tTry overloading boost::any AnyAlgebra::AddImpl()" << std::endl << std::endl;
183  std::cerr << "\tError in AnyAlgebra::AddImpl()" << std::endl << std::endl;
184 
185  return boost::none;
186 }
187 
188 boost::any AnyAlgebra::Subtract(boost::any const& in0, boost::any const& in1) const {
189  if( ScalarAlgebra::IsScalar(in0.type()) && ScalarAlgebra::IsScalar(in1.type()) ) { return ScalarAlgebra::Subtract(in0, in1); }
190 
191  if( EigenVectorAlgebra::IsEigenVector(in0.type()) && EigenVectorAlgebra::IsEigenVector(in1.type()) ) { return EigenVectorAlgebra::Subtract(in0, in1); }
192 
193  if( EigenMatrixAlgebra::IsEigenMatrix(in0.type()) && EigenMatrixAlgebra::IsEigenMatrix(in1.type()) ) { return EigenMatrixAlgebra::Subtract(in0, in1); }
194 
195  // the first type is boost::none --- return the second
196  if( in0.type()==typeid(boost::none) ) { return in1; }
197 
198  // the second type is boost::none --- return the first
199  if( in1.type()==typeid(boost::none) ) { return in0; }
200 
201  return SubtractImpl(in0, in1);
202 }
203 
204 boost::any AnyAlgebra::SubtractImpl(boost::any const& in0, boost::any const& in1) const {
205  std::cerr << std::endl << "ERROR: No way to subtract type " << boost::core::demangle(in0.type().name()) << " and type " << boost::core::demangle(in1.type().name()) << std::endl;
206  std::cerr << "\tTry overloading boost::any AnyAlgebra::SubtractImpl()" << std::endl << std::endl;
207  std::cerr << "\tError in AnyAlgebra::SubtractImpl()" << std::endl << std::endl;
208 
209  return boost::none;
210 }
211 
212 boost::any AnyAlgebra::Multiply(boost::any const& in0, boost::any const& in1) const {
213  if( ScalarAlgebra::IsScalar(in0.type()) && ScalarAlgebra::IsScalar(in1.type()) ) { return ScalarAlgebra::Multiply(in0, in1); }
214 
215  if( ScalarAlgebra::IsScalar(in0.type()) && EigenVectorAlgebra::IsEigenVector(in1.type()) ) { return EigenVectorAlgebra::ScalarMultiply(in0, in1); }
216  if( ScalarAlgebra::IsScalar(in1.type()) && EigenVectorAlgebra::IsEigenVector(in0.type()) ) { return EigenVectorAlgebra::ScalarMultiply(in1, in0); }
217 
218  if( EigenMatrixAlgebra::IsEigenMatrix(in0.type()) && EigenMatrixAlgebra::IsEigenMatrix(in1.type()) ) { return EigenMatrixAlgebra::Multiply(in0, in1); }
219 
220  if( ScalarAlgebra::IsScalar(in0.type()) && EigenMatrixAlgebra::IsEigenMatrix(in1.type()) ) { return EigenMatrixAlgebra::ScalarMultiply(in0, in1); }
221  if( ScalarAlgebra::IsScalar(in1.type()) && EigenMatrixAlgebra::IsEigenMatrix(in0.type()) ) { return EigenMatrixAlgebra::ScalarMultiply(in1, in0); }
222 
223  // the first type is boost::none --- return the second
224  if( in0.type()==typeid(boost::none) ) { return in1; }
225 
226  // the second type is boost::none --- return the first
227  if( in1.type()==typeid(boost::none) ) { return in0; }
228 
229  return MultiplyImpl(in0, in1);
230 }
231 
232 boost::any AnyAlgebra::MultiplyImpl(boost::any const& in0, boost::any const& in1) const {
233  std::cerr << std::endl << "ERROR: No way to multiply type " << boost::core::demangle(in0.type().name()) << " and type " << boost::core::demangle(in1.type().name()) << std::endl;
234  std::cerr << "\tTry overloading boost::any AnyAlgebra::MultiplyImpl()" << std::endl << std::endl;
235  std::cerr << "\tError in AnyAlgebra::MultiplyImpl()" << std::endl << std::endl;
236 
237  return boost::none;
238 }
239 
240 boost::any AnyAlgebra::ApplyInverse(boost::any const& A, boost::any const& x) const {
241  if( ScalarAlgebra::IsScalar(A.type()) ) { return Multiply(Inverse(A), x); }
242 
243  if( EigenVectorAlgebra::IsEigenVector(A.type()) ) { return EigenVectorAlgebra::ApplyInverse(A, x); }
244 
245  if( EigenMatrixAlgebra::IsEigenMatrix(A.type()) ) { return EigenMatrixAlgebra::ApplyInverse(A, x); }
246 
247  return ApplyInverseImpl(A, x);
248 }
249 
250 boost::any AnyAlgebra::ApplyInverseImpl(boost::any const& A, boost::any const& x) const {
251  std::cerr << std::endl << "ERROR: No way to apply the inverse " << boost::core::demangle(A.type().name()) << " type to type " << boost::core::demangle(x.type().name()) << std::endl;
252  std::cerr << "\tTry overloading boost::any AnyAlgebra::ApplyInverseImpl()" << std::endl << std::endl;
253  std::cerr << "\tError in AnyAlgebra::ApplyInverseImpl()" << std::endl << std::endl;
254 
255  return boost::none;
256 }
257 
258 boost::any AnyAlgebra::Apply(boost::any const& A, boost::any const& x) const {
259  if( ScalarAlgebra::IsScalar(A.type()) ) { return Multiply(A, x); }
260 
261  if( EigenVectorAlgebra::IsEigenVector(A.type()) ) { return EigenVectorAlgebra::Apply(A, x); }
262 
263  if( EigenMatrixAlgebra::IsEigenMatrix(A.type()) ) { return EigenMatrixAlgebra::Apply(A, x); }
264 
265  return ApplyImpl(A, x);
266 }
267 
268 boost::any AnyAlgebra::ApplyImpl(boost::any const& A, boost::any const& x) const {
269  std::cerr << std::endl << "ERROR: No way to apply " << boost::core::demangle(A.type().name()) << " type to type " << boost::core::demangle(x.type().name()) << std::endl;
270  std::cerr << "\tTry overloading boost::any AnyAlgebra::ApplyImpl()" << std::endl << std::endl;
271  std::cerr << "\tError in AnyAlgebra::ApplyImpl()" << std::endl << std::endl;
272 
273  return boost::none;
274 }
275 
276 boost::any AnyAlgebra::Inverse(boost::any const& obj) const {
277  if( ScalarAlgebra::IsScalar(obj.type()) ) { return ScalarAlgebra::Inverse(obj); }
278 
279  return InverseImpl(obj);
280 }
281 
282 boost::any AnyAlgebra::InverseImpl(boost::any const& obj) const {
283  std::cerr << std::endl << "ERROR: No way to compute the inverse of type " << boost::core::demangle(obj.type().name()) << std::endl;
284  std::cerr << "\tTry overloading boost::any AnyAlgebra::InverseImpl()" << std::endl << std::endl;
285  std::cerr << "\tError in AnyAlgebra::InverseImpl()" << std::endl << std::endl;
286 
287  return boost::none;
288 }
289 
290 boost::any AnyAlgebra::SquareRoot(boost::any const& obj) const {
291  if( ScalarAlgebra::IsScalar(obj.type()) ) { return ScalarAlgebra::SquareRoot(obj); }
292 
293  if( EigenVectorAlgebra::IsEigenVector(obj.type()) ) { return EigenVectorAlgebra::SquareRoot(obj); }
294 
295  if( EigenMatrixAlgebra::IsEigenMatrix(obj.type()) ) { return EigenMatrixAlgebra::SquareRoot(obj); }
296 
297  return SquareRootImpl(obj);
298 }
299 
300 boost::any AnyAlgebra::SquareRootImpl(boost::any const& obj) const {
301  std::cerr << std::endl << "ERROR: No way to compute the square root of type " << boost::core::demangle(obj.type().name()) << std::endl;
302  std::cerr << "\tTry overloading boost::any AnyAlgebra::SquareRootImpl()" << std::endl << std::endl;
303  std::cerr << "\tError in AnyAlgebra::SquareRootImpl()" << std::endl << std::endl;
304 
305  return boost::none;
306 }
307 
308 double AnyAlgebra::LogDeterminate(boost::any const& obj) const {
309  if( ScalarAlgebra::IsScalar(obj.type()) ) { return ScalarAlgebra::LogDeterminate(obj); }
310 
311  if( EigenVectorAlgebra::IsEigenVector(obj.type()) ) { return EigenVectorAlgebra::LogDeterminate(obj); }
312 
313  if( EigenMatrixAlgebra::IsEigenMatrix(obj.type()) ) { return EigenMatrixAlgebra::LogDeterminate(obj); }
314 
315  return LogDeterminateImpl(obj);
316 }
317 
318 double AnyAlgebra::LogDeterminateImpl(boost::any const& obj) const {
319  std::cerr << std::endl << "ERROR: No way to compute the determinate of type " << boost::core::demangle(obj.type().name()) << std::endl;
320  std::cerr << "\tTry overloading boost::any AnyAlgebra::DeterminateImpl()" << std::endl << std::endl;
321  std::cerr << "\tError in AnyAlgebra::DeterminateImpl()" << std::endl << std::endl;
322 
323  return -1.0;
324 }
325 
virtual boost::any ZeroImpl(std::type_info const &type, unsigned int const rows, unsigned int const cols) const
Compute a zero object for boost::any.
Definition: AnyAlgebra.cpp:47
virtual boost::any IdentityImpl(std::type_info const &type, unsigned int const rows, unsigned int const cols) const
Compute an identity object.
Definition: AnyAlgebra.cpp:156
boost::any Add(boost::any const &in0, boost::any const &in1) const
Add two objects together.
Definition: AnyAlgebra.cpp:164
AnyAlgebra()
Default constructor.
Definition: AnyAlgebra.cpp:5
boost::any Identity(std::type_info const &type, unsigned int const rows=0, unsigned int const cols=0) const
Compute an identity object.
Definition: AnyAlgebra.cpp:146
boost::any Inverse(boost::any const &obj) const
The inverse.
Definition: AnyAlgebra.cpp:276
virtual boost::any SquareRootImpl(boost::any const &obj) const
Compute the square root of an object.
Definition: AnyAlgebra.cpp:300
boost::any OuterProduct(boost::any const &vec1, boost::any const &vec2) const
The outer product between two vectors.
Definition: AnyAlgebra.cpp:89
boost::any Apply(boost::any const &A, boost::any const &x) const
Apply a matrix (mat-vec)
Definition: AnyAlgebra.cpp:258
boost::any Zero(std::type_info const &type, unsigned int const rows=0, unsigned int const cols=0) const
Compute a zero vector.
Definition: AnyAlgebra.cpp:33
double InnerProduct(boost::any const &vec1, boost::any const &vec2) const
The inner product between two vectors.
Definition: AnyAlgebra.cpp:73
virtual boost::any SubtractImpl(boost::any const &in0, boost::any const &in1) const
Subtract two objects.
Definition: AnyAlgebra.cpp:204
virtual bool IsZeroImpl(boost::any const &obj) const
Determine if an object is the zero object.
Definition: AnyAlgebra.cpp:116
double LogDeterminate(boost::any const &obj) const
Compute the log-determinate.
Definition: AnyAlgebra.cpp:308
virtual boost::any AddImpl(boost::any const &in0, boost::any const &in1) const
Add two objects together.
Definition: AnyAlgebra.cpp:180
virtual double InnerProductImpl(boost::any const &vec1, boost::any const &vec2) const
The inner product between two vectors.
Definition: AnyAlgebra.cpp:81
virtual double LogDeterminateImpl(boost::any const &obj) const
Compute the log-determinate.
Definition: AnyAlgebra.cpp:318
virtual double NormImpl(boost::any const &obj) const
The norm of an object.
Definition: AnyAlgebra.cpp:65
virtual boost::any ApplyImpl(boost::any const &A, boost::any const &x) const
Apply a matrix (mat-vec)
Definition: AnyAlgebra.cpp:268
boost::any SquareRoot(boost::any const &obj) const
Compute the square root of an object.
Definition: AnyAlgebra.cpp:290
virtual boost::any ApplyInverseImpl(boost::any const &A, boost::any const &x) const
Apply the inverse of a matrix.
Definition: AnyAlgebra.cpp:250
virtual boost::any OuterProductImpl(boost::any const &vec1, boost::any const &vec2) const
The outer product between two vectors.
Definition: AnyAlgebra.cpp:98
boost::any Multiply(boost::any const &in0, boost::any const &in1) const
Multiply two objects.
Definition: AnyAlgebra.cpp:212
unsigned int Size(boost::any const &obj, int const dim=-1) const
The size of an object.
Definition: AnyAlgebra.cpp:7
bool IsZero(boost::any const &obj) const
Determine if an object is the zero object.
Definition: AnyAlgebra.cpp:106
boost::any Subtract(boost::any const &in0, boost::any const &in1) const
Subtract two objects.
Definition: AnyAlgebra.cpp:188
boost::any ApplyInverse(boost::any const &A, boost::any const &x) const
Apply the inverse of a matrix.
Definition: AnyAlgebra.cpp:240
double Norm(boost::any const &obj) const
The norm of an object.
Definition: AnyAlgebra.cpp:55
boost::any AccessElement(boost::any const &obj, unsigned int const i=0, unsigned int const j=0) const
Access an element of a vector/matrix.
Definition: AnyAlgebra.cpp:124
virtual boost::any AccessElementImpl(boost::any const &vec, unsigned int const i) const
Access an element of a vector.
Definition: AnyAlgebra.cpp:138
virtual boost::any MultiplyImpl(boost::any const &in0, boost::any const &in1) const
Multiply two objects.
Definition: AnyAlgebra.cpp:232
virtual boost::any InverseImpl(boost::any const &obj) const
The inverse.
Definition: AnyAlgebra.cpp:282
virtual unsigned int SizeImpl(boost::any const &obj) const
The size of an object (implemented by a child for non standard types)
Definition: AnyAlgebra.cpp:25
static boost::any SquareRoot(boost::any const &obj)
Compute the square root of an object.
static bool IsScalar(std::type_info const &obj_type)
Is a boost::any a scalar type (double, float, int, or unsigned int)?
static bool IsZero(boost::any const &obj)
Determine if a scalar is zero.
static boost::any OuterProduct(boost::any const &vec1, boost::any const &vec2)
The outer product between two scalars.
static boost::any Add(boost::any const &in0, boost::any const &in1)
Add two scalars together.
static double Norm(boost::any const &obj)
Get the norm of a scalar (the magnitude)
static boost::any Multiply(boost::any const &in0, boost::any const &in1)
Multiply two scalars.
static double InnerProduct(boost::any const &vec1, boost::any const &vec2)
The inner product between two scalars.
static boost::any Identity(std::type_info const &type)
Compute an identity object for a scalar.
static boost::any Subtract(boost::any const &in0, boost::any const &in1)
Subtract two scalars.
static double LogDeterminate(boost::any const &obj)
Compute the log-determinate.
static boost::any Inverse(boost::any const &obj)
The inverse.
static boost::any Zero(std::type_info const &type)
Compute a zero scalar.
static bool IsSundialsVector(std::type_info const &obj)
Is a boost::any an N_Vector type?
static unsigned int Size(boost::any const &vec)
The size of an N_Vector.
static boost::any AccessElement(N_Vector const &obj, unsigned int const i)
Access an element of a Sundials vector.
std::string demangle(const char *name)
Definition: Demangler.cpp:6