diff options
author | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2009-12-07 19:10:11 +0000 |
---|---|---|
committer | Jitse Niesen <jitse@maths.leeds.ac.uk> | 2009-12-07 19:10:11 +0000 |
commit | 39ceba409b4b0295f0c70872cf2592503b54eba2 (patch) | |
tree | 3babbe06c6534b9bafb6cebda86ae972e4848ab0 | |
parent | 36969cc2a5c2d0d3a52510b68c203b920eb4d3de (diff) |
Various improvements to the docs for unsupported.
* Enable compilation of examples for unsupported.
* Fix use of std::vector in BVH example.
* Add an example for the matrix exponential.
* Bug fixes in unsupported/doc/{examples,snippets}/CMakeLists.txt .
-rw-r--r-- | doc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h | 16 | ||||
-rw-r--r-- | unsupported/doc/CMakeLists.txt | 2 | ||||
-rw-r--r-- | unsupported/doc/examples/BVH_Example.cpp | 4 | ||||
-rw-r--r-- | unsupported/doc/examples/CMakeLists.txt | 2 | ||||
-rw-r--r-- | unsupported/doc/examples/MatrixExponential.cpp | 18 | ||||
-rw-r--r-- | unsupported/doc/snippets/CMakeLists.txt | 2 |
7 files changed, 42 insertions, 4 deletions
diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 1d20a6075..af756a516 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -63,7 +63,7 @@ add_custom_target( ) add_dependencies(doc-eigen-prerequisites all_snippets all_examples) -# add_dependencies(doc-unsupported-prerequisites unsupported_snippets unsupported_examples) +add_dependencies(doc-unsupported-prerequisites unsupported_snippets unsupported_examples) add_custom_target(doc ALL COMMAND doxygen Doxyfile-unsupported COMMAND doxygen diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h index 6510b6814..bb4706c35 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h @@ -58,6 +58,22 @@ * <em>SIAM J. %Matrix Anal. Applic.</em>, <b>26</b>:1179–1193, * 2005. * + * Example: The following program checks that + * \f[ \exp \left[ \begin{array}{ccc} + * 0 & \frac14\pi & 0 \\ + * -\frac14\pi & 0 & 0 \\ + * 0 & 0 & 0 + * \end{array} \right] = \left[ \begin{array}{ccc} + * \frac12\sqrt2 & -\frac12\sqrt2 & 0 \\ + * \frac12\sqrt2 & \frac12\sqrt2 & 0 \\ + * 0 & 0 & 1 + * \end{array} \right]. \f] + * This corresponds to a rotation of \f$ \frac14\pi \f$ radians around + * the z-axis. + + * \include MatrixExponential.cpp + * Output: \verbinclude MatrixExponential.out + * * \note \p M has to be a matrix of \c float, \c double, * \c complex<float> or \c complex<double> . */ diff --git a/unsupported/doc/CMakeLists.txt b/unsupported/doc/CMakeLists.txt index 2cff2510f..a50d07798 100644 --- a/unsupported/doc/CMakeLists.txt +++ b/unsupported/doc/CMakeLists.txt @@ -1,6 +1,8 @@ set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE) + if(NOT MSVC) add_subdirectory(examples) + add_subdirectory(snippets) endif(NOT MSVC) diff --git a/unsupported/doc/examples/BVH_Example.cpp b/unsupported/doc/examples/BVH_Example.cpp index 890eb535b..0fbab5fdb 100644 --- a/unsupported/doc/examples/BVH_Example.cpp +++ b/unsupported/doc/examples/BVH_Example.cpp @@ -1,3 +1,4 @@ +#include <Eigen/StdVector> #include <unsupported/Eigen/BVH> using namespace Eigen; @@ -20,7 +21,8 @@ struct PointPointMinimizer //how to compute squared distances between points and int main() { - std::vector<Vector2d> redPoints, bluePoints; + typedef std::vector<Vector2d, aligned_allocator<Vector2d> > StdVectorOfVector2d; + StdVectorOfVector2d redPoints, bluePoints; for(int i = 0; i < 100; ++i) { //initialize random set of red points and blue points redPoints.push_back(Vector2d::Random()); bluePoints.push_back(Vector2d::Random()); diff --git a/unsupported/doc/examples/CMakeLists.txt b/unsupported/doc/examples/CMakeLists.txt index d78af13a9..cb42b2ab9 100644 --- a/unsupported/doc/examples/CMakeLists.txt +++ b/unsupported/doc/examples/CMakeLists.txt @@ -6,7 +6,7 @@ FOREACH(example_src ${examples_SRCS}) GET_FILENAME_COMPONENT(example ${example_src} NAME_WE) ADD_EXECUTABLE(example_${example} ${example_src}) GET_TARGET_PROPERTY(example_executable - ${example} LOCATION) + example_${example} LOCATION) ADD_CUSTOM_COMMAND( TARGET example_${example} POST_BUILD diff --git a/unsupported/doc/examples/MatrixExponential.cpp b/unsupported/doc/examples/MatrixExponential.cpp new file mode 100644 index 000000000..86062e3a6 --- /dev/null +++ b/unsupported/doc/examples/MatrixExponential.cpp @@ -0,0 +1,18 @@ +#include <unsupported/Eigen/MatrixFunctions> + +using namespace Eigen; + +int main() +{ + const double pi = std::acos(-1); + + MatrixXd A(3,3); + A << 0, -pi/4, 0, + pi/4, 0, 0, + 0, 0, 0; + std::cout << "The matrix A is:\n" << A << "\n\n"; + + MatrixXd B; + ei_matrix_exponential(A, &B); + std::cout << "The matrix exponential of A is:\n" << B << "\n\n"; +} diff --git a/unsupported/doc/snippets/CMakeLists.txt b/unsupported/doc/snippets/CMakeLists.txt index fa529d139..19e9b1a1f 100644 --- a/unsupported/doc/snippets/CMakeLists.txt +++ b/unsupported/doc/snippets/CMakeLists.txt @@ -7,7 +7,7 @@ FOREACH(snippet_src ${snippets_SRCS}) SET(compile_snippet_target compile_${snippet}) SET(compile_snippet_src ${compile_snippet_target}.cpp) FILE(READ ${snippet_src} snippet_source_code) - CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/compile_snippet.cpp.in + CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/snippets/compile_snippet.cpp.in ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) ADD_EXECUTABLE(${compile_snippet_target} ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) |