From 647a817b2e352ae8f3599ba393d344f83d3b416e Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 20 Dec 2007 21:11:05 +0000 Subject: [PATCH] more documentation and examples, add Doxyfile and Mainpage.dox and also the benchmark program --- Doxyfile | 281 +++++++++++++++++++++++++++++ Mainpage.dox | 123 +++++++++++++ doc/benchmark.cpp | 23 +++ doc/examples/function_dynBlock.cpp | 19 ++ src/Core/Cast.h | 2 + src/Core/Column.h | 2 + src/Core/DynBlock.h | 10 + src/Core/MatrixBase.h | 12 +- src/Core/Minor.h | 3 + src/Core/Row.h | 2 + 10 files changed, 466 insertions(+), 11 deletions(-) create mode 100644 Doxyfile create mode 100644 Mainpage.dox create mode 100644 doc/benchmark.cpp create mode 100644 doc/examples/function_dynBlock.cpp diff --git a/Doxyfile b/Doxyfile new file mode 100644 index 000000000..d009f348c --- /dev/null +++ b/Doxyfile @@ -0,0 +1,281 @@ +# Doxyfile 1.5.3 + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 +PROJECT_NAME = Eigen +PROJECT_NUMBER = 2.0-alpha1 +OUTPUT_DIRECTORY = ./ +CREATE_SUBDIRS = NO +OUTPUT_LANGUAGE = English +BRIEF_MEMBER_DESC = YES +REPEAT_BRIEF = YES +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the +ALWAYS_DETAILED_SEC = NO +INLINE_INHERITED_MEMB = NO +FULL_PATH_NAMES = NO +STRIP_FROM_PATH = +STRIP_FROM_INC_PATH = +SHORT_NAMES = NO +JAVADOC_AUTOBRIEF = NO +QT_AUTOBRIEF = NO +MULTILINE_CPP_IS_BRIEF = NO +DETAILS_AT_TOP = NO +INHERIT_DOCS = YES +SEPARATE_MEMBER_PAGES = NO +TAB_SIZE = 8 +ALIASES = +OPTIMIZE_OUTPUT_FOR_C = NO +OPTIMIZE_OUTPUT_JAVA = NO +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +DISTRIBUTE_GROUP_DOC = NO +SUBGROUPING = YES +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- +EXTRACT_ALL = NO +EXTRACT_PRIVATE = NO +EXTRACT_STATIC = NO +EXTRACT_LOCAL_CLASSES = NO +EXTRACT_LOCAL_METHODS = NO +EXTRACT_ANON_NSPACES = NO +HIDE_UNDOC_MEMBERS = YES +HIDE_UNDOC_CLASSES = YES +HIDE_FRIEND_COMPOUNDS = YES +HIDE_IN_BODY_DOCS = NO +INTERNAL_DOCS = NO +CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = YES +SHOW_INCLUDE_FILES = YES +INLINE_INFO = YES +SORT_MEMBER_DOCS = YES +SORT_BRIEF_DOCS = NO +SORT_BY_SCOPE_NAME = NO +GENERATE_TODOLIST = YES +GENERATE_TESTLIST = YES +GENERATE_BUGLIST = YES +GENERATE_DEPRECATEDLIST= YES +ENABLED_SECTIONS = +MAX_INITIALIZER_LINES = 30 +SHOW_USED_FILES = YES +SHOW_DIRECTORIES = NO +FILE_VERSION_FILTER = +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- +QUIET = NO +WARNINGS = YES +WARN_IF_UNDOCUMENTED = YES +WARN_IF_DOC_ERROR = YES +WARN_NO_PARAMDOC = NO +WARN_FORMAT = "$file:$line: $text" +WARN_LOGFILE = +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- +INPUT = src/ ./ +INPUT_ENCODING = UTF-8 +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.d \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.idl \ + *.odl \ + *.cs \ + *.php \ + *.php3 \ + *.inc \ + *.m \ + *.mm \ + *.dox \ + *.py \ + *.C \ + *.CC \ + *.C++ \ + *.II \ + *.I++ \ + *.H \ + *.HH \ + *.H++ \ + *.CS \ + *.PHP \ + *.PHP3 \ + *.M \ + *.MM \ + *.PY +RECURSIVE = NO +EXCLUDE = +EXCLUDE_SYMLINKS = NO +EXCLUDE_PATTERNS = +EXCLUDE_SYMBOLS = +EXAMPLE_PATH = doc/examples/ +EXAMPLE_PATTERNS = * +EXAMPLE_RECURSIVE = NO +IMAGE_PATH = +INPUT_FILTER = +FILTER_PATTERNS = +FILTER_SOURCE_FILES = NO +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- +SOURCE_BROWSER = NO +INLINE_SOURCES = NO +STRIP_CODE_COMMENTS = YES +REFERENCED_BY_RELATION = YES +REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +USE_HTAGS = NO +VERBATIM_HEADERS = YES +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- +ALPHABETICAL_INDEX = NO +COLS_IN_ALPHA_INDEX = 5 +IGNORE_PREFIX = +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- +GENERATE_HTML = YES +HTML_OUTPUT = html +HTML_FILE_EXTENSION = .html +HTML_HEADER = +HTML_FOOTER = +HTML_STYLESHEET = +HTML_ALIGN_MEMBERS = YES +GENERATE_HTMLHELP = NO +HTML_DYNAMIC_SECTIONS = NO +CHM_FILE = +HHC_LOCATION = +GENERATE_CHI = NO +BINARY_TOC = NO +TOC_EXPAND = NO +DISABLE_INDEX = NO +ENUM_VALUES_PER_LINE = 4 +GENERATE_TREEVIEW = NO +TREEVIEW_WIDTH = 250 +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- +GENERATE_LATEX = YES +LATEX_OUTPUT = latex +LATEX_CMD_NAME = latex +MAKEINDEX_CMD_NAME = makeindex +COMPACT_LATEX = NO +PAPER_TYPE = a4wide +EXTRA_PACKAGES = +LATEX_HEADER = +PDF_HYPERLINKS = NO +USE_PDFLATEX = NO +LATEX_BATCHMODE = NO +LATEX_HIDE_INDICES = NO +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- +GENERATE_RTF = NO +RTF_OUTPUT = rtf +COMPACT_RTF = NO +RTF_HYPERLINKS = NO +RTF_STYLESHEET_FILE = +RTF_EXTENSIONS_FILE = +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- +GENERATE_MAN = NO +MAN_OUTPUT = man +MAN_EXTENSION = .3 +MAN_LINKS = NO +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- +GENERATE_XML = NO +XML_OUTPUT = xml +XML_SCHEMA = +XML_DTD = +XML_PROGRAMLISTING = YES +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- +GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- +GENERATE_PERLMOD = NO +PERLMOD_LATEX = NO +PERLMOD_PRETTY = YES +PERLMOD_MAKEVAR_PREFIX = +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- +ENABLE_PREPROCESSING = YES +MACRO_EXPANSION = NO +EXPAND_ONLY_PREDEF = NO +SEARCH_INCLUDES = YES +INCLUDE_PATH = +INCLUDE_FILE_PATTERNS = +PREDEFINED = +EXPAND_AS_DEFINED = +SKIP_FUNCTION_MACROS = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- +TAGFILES = +GENERATE_TAGFILE = +ALLEXTERNALS = NO +EXTERNAL_GROUPS = YES +PERL_PATH = /usr/bin/perl +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- +CLASS_DIAGRAMS = YES +MSCGEN_PATH = +HIDE_UNDOC_RELATIONS = YES +HAVE_DOT = YES +CLASS_GRAPH = YES +COLLABORATION_GRAPH = YES +GROUP_GRAPHS = YES +UML_LOOK = NO +TEMPLATE_RELATIONS = NO +INCLUDE_GRAPH = YES +INCLUDED_BY_GRAPH = YES +CALL_GRAPH = NO +CALLER_GRAPH = NO +GRAPHICAL_HIERARCHY = YES +DIRECTORY_GRAPH = YES +DOT_IMAGE_FORMAT = png +DOT_PATH = +DOTFILE_DIRS = +DOT_GRAPH_MAX_NODES = 50 +MAX_DOT_GRAPH_DEPTH = 1000 +DOT_TRANSPARENT = NO +DOT_MULTI_TARGETS = NO +GENERATE_LEGEND = YES +DOT_CLEANUP = YES +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- +SEARCHENGINE = NO diff --git a/Mainpage.dox b/Mainpage.dox new file mode 100644 index 000000000..591754bba --- /dev/null +++ b/Mainpage.dox @@ -0,0 +1,123 @@ +o /** @mainpage Eigen + +

Table of contents

+Overview
+License
+Features
+News
+Download
+Relation to KDE
+Examples
+Applications using Eigen
+Authors
+Contact us
+Mailing list
+ + +

Overview

+ +Eigen is a C++ template library for vector and matrix math, a.k.a. linear algebra. It aims to concile speed, ease of use, and completeness. + + +

License

+ + Eigen is distributed under the GPL, version 2 or later, but with an exception allowing any software to use it. Thus, to the question +"Can my own project use Eigen?", the answer is a definite yes. + +Eigen's exception is modeled after the one of the GNU C++ Standard Library, but is simpler and more liberal. + +This is similar to the LGPL in spirit. The reason why we don't use the LGPL is that, as of version 2, it doesn't make sense for a pure template library like Eigen, where all the code is in headers. + + +

Features

+ +WARNING: this alpha release is NOT feature complete -- far from it! It contains only the Core module, while several other modules are planned. + + + + +

News

+ +If you want to stay informed of Eigen news and releases, please subscribe to our mailing list. You can also browse the archive. + + +

Download

+The source code of the latest release is here: eigen-2.0-alpha1.tar.gz
+ +Alternatively, you can checkout the development tree by anonymous svn, by doing: +
svn co svn://anonsvn.kde.org/home/kde/branches/work/eigen2
+or view it online at this address: +http://websvn.kde.org/branches/work/eigen2 + + +

Relation to KDE

+ +First of all: Eigen doesn't have any dependency. In particular, it doesn't depend on any part of KDE or on Qt.
+ +Eigen is part of the KDE project, in the sense that: + +However, we quickly realized that Eigen could be useful for non-KDE projects, whence our decision to make sure that it has no dependency on KDE or Qt. + +Although Eigen itself doesn't have any dependency, the unit-tests require Qt. + + +

Examples

+ +TODO: write more examples, update this section. + + +

Applications using Eigen

+ +TODO: update this section + +Please tell us if you know of other interesting projects using Eigen! + + +

Authors

+ +Lead Developer: Benoit Jacob (jacob at math jussieu fr) + +Contributors during the Eigen 2 development process: + + + +

Contact us

+ +The best way to contact us is by means of our mailing list.
+IRC Channel: \#eigen on Freenode.
+Website (you're here): http://eigen.tuxfamily.org
+ + +

Mailing list

+ +The Mailing list for Eigen is: eigen at lists tuxfamily org.
+ +To subscribe, send a mail with subject "subscribe" to eigen-request at lists tuxfamily org.
+To unsubscribe, send a mail with subject "unsubscribe" to eigen-request at lists tuxfamily org.
+ +You can also browse the archive. + + +

Exception to the GPL

+Eigen is licensed under the GNU GPL, version 2 or later, plus the following exception, which is replicated into each of the source files of Eigen: +
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. This exception does not invalidate any other reasons why a work
+// based on this file might be covered by the GNU General Public License.
+
+ +*/ diff --git a/doc/benchmark.cpp b/doc/benchmark.cpp new file mode 100644 index 000000000..ae2a52e9c --- /dev/null +++ b/doc/benchmark.cpp @@ -0,0 +1,23 @@ +// g++ -O3 -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark + +#include "src/Core.h" + +using namespace std; +USING_EIGEN_DATA_TYPES + +int main(int argc, char *argv[]) +{ + Matrix3d I; + Matrix3d m; + for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) + { + I(i,j) = (i==j); + m(i,j) = (i+3*j); + } + for(int a = 0; a < 100000000; a++) + { + m = I + 0.00005 * (m + m*m); + } + cout << m << endl; + return 0; +} diff --git a/doc/examples/function_dynBlock.cpp b/doc/examples/function_dynBlock.cpp new file mode 100644 index 000000000..bd3cbae1f --- /dev/null +++ b/doc/examples/function_dynBlock.cpp @@ -0,0 +1,19 @@ +#include "../src/Core.h" +USING_EIGEN_DATA_TYPES +using namespace std; +int main(int, char**) +{ + Matrix4d m = Matrix4d::identity(); + m.dynBlock(2,0,2,2) = m.dynBlock(0,0,2,2); + cout << m << endl; + return 0; +} + +/* Output: + +1 0 0 0 +0 1 0 0 +1 0 1 0 +0 1 0 1 + +*/ diff --git a/src/Core/Cast.h b/src/Core/Cast.h index 7dfce45b0..4d6a30159 100644 --- a/src/Core/Cast.h +++ b/src/Core/Cast.h @@ -55,6 +55,8 @@ template class Cast : NoOperatorEquals, MatRef m_matrix; }; +/** \returns an expression of *this with the \a Scalar type casted to + * \a NewScalar. */ template template const Cast diff --git a/src/Core/Column.h b/src/Core/Column.h index 39b8263e7..d1d7f1453 100644 --- a/src/Core/Column.h +++ b/src/Core/Column.h @@ -67,6 +67,8 @@ template class Column const int m_col; }; +/** \returns an expression of the \a i-th column of *this. + * \sa row(int) */ template Column MatrixBase::col(int i) const diff --git a/src/Core/DynBlock.h b/src/Core/DynBlock.h index 3fa0e9c9b..b6795151c 100644 --- a/src/Core/DynBlock.h +++ b/src/Core/DynBlock.h @@ -75,6 +75,16 @@ template class DynBlock const int m_startRow, m_startCol, m_blockRows, m_blockCols; }; +/** \returns a dynamic-size expression of a block in *this. + * + * \param startRow the first row in the block + * \param startCol the first column in the block + * \param blockRows the number of rows in the block + * \param blockCols the number of columns in the block + * + * Example: + * \include MatrixBase_dynBlock.cpp + */ template DynBlock MatrixBase ::dynBlock(int startRow, int startCol, int blockRows, int blockCols) const diff --git a/src/Core/MatrixBase.h b/src/Core/MatrixBase.h index db8eaadb5..6ca815ef0 100644 --- a/src/Core/MatrixBase.h +++ b/src/Core/MatrixBase.h @@ -46,7 +46,7 @@ * * \code template - void printFirstRow(const Eigen::MatrixBase& m) + void printFirstRow(const Eigen::MatrixBase& x) { cout << x.row(0) << endl; } @@ -111,21 +111,11 @@ template class MatrixBase return this->operator=(other); } - /** \returns an expression of *this with the \a Scalar type casted to - * \a NewScalar. */ template const Cast cast() const; - /** \returns an expression of the \a i-th row of *this. - * \sa col(int)*/ Row row(int i) const; - /** \returns an expression of the \a i-th column of *this. - * \sa row(int) */ Column col(int i) const; - /** \return an expression of the (\a row, \a col)-minor of *this, - * i.e. an expression constructed from *this by removing the specified - * row and column. */ Minor minor(int row, int col) const; - DynBlock dynBlock(int startRow, int startCol, int blockRows, int blockCols) const; template diff --git a/src/Core/Minor.h b/src/Core/Minor.h index 01389ed22..50422c5dd 100644 --- a/src/Core/Minor.h +++ b/src/Core/Minor.h @@ -73,6 +73,9 @@ template class Minor const int m_row, m_col; }; +/** \return an expression of the (\a row, \a col)-minor of *this, + * i.e. an expression constructed from *this by removing the specified + * row and column. */ template Minor MatrixBase::minor(int row, int col) const diff --git a/src/Core/Row.h b/src/Core/Row.h index af46dc280..a9168bb45 100644 --- a/src/Core/Row.h +++ b/src/Core/Row.h @@ -75,6 +75,8 @@ template class Row const int m_row; }; +/** \returns an expression of the \a i-th row of *this. + * \sa col(int)*/ template Row MatrixBase::row(int i) const