example-SphericalEngine.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::SphericalEngine class
2 
3 #include <iostream>
4 #include <exception>
5 #include <vector>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  // See also example-SphericHarmonic.cpp
13  try {
14  int N = 3; // The maxium degree
15  double ca[] = {10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; // cosine coefficients
16  vector<double> C(ca, ca + (N + 1) * (N + 2) / 2);
17  double sa[] = {6, 5, 4, 3, 2, 1}; // sine coefficients
18  vector<double> S(sa, sa + N * (N + 1) / 2);
20  c[0] = SphericalEngine::coeff(C, S, N);
21  double f[] = {1};
22  double x = 2, y = 3, z = 1, a = 1;
23  double v, vx, vy, vz;
24  v = SphericalEngine::Value<true, SphericalEngine::FULL, 1>
25  (c, f, x, y, z, a, vx, vy, vz);
26  cout << v << " " << vx << " " << vy << " " << vz << "\n";
27  }
28  catch (const exception& e) {
29  cerr << "Caught exception: " << e.what() << "\n";
30  return 1;
31  }
32 }
SphericalEngine.hpp
Header for GeographicLib::SphericalEngine class.
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
GeographicLib::SphericalEngine::coeff
Package up coefficients for SphericalEngine.
Definition: SphericalEngine.hpp:99
main
int main()
Definition: example-SphericalEngine.cpp:11
vy
StridedVectorType vy(make_vector(y, *n, std::abs(*incy)))
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition: bench_gemm.cpp:50
std
Definition: BFloat16.h:88
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
N
#define N
Definition: igam.h:9
S
DiscreteKey S(1, 2)
vx
StridedVectorType vx(make_vector(x, *n, std::abs(*incx)))


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:31