瀏覽代碼

Added section on eigenvalues

Clemens-Alexander Brust 11 年之前
父節點
當前提交
03ba867e80
共有 1 個文件被更改,包括 25 次插入1 次删除
  1. 25 1
      core/tutorial/doc/06_algebra.md

+ 25 - 1
core/tutorial/doc/06_algebra.md

@@ -7,7 +7,8 @@ Use the _SVD_ class for fast singular value decomposition.
 The calculation is performed at initialization and the resulting
 The calculation is performed at initialization and the resulting
 matrices are available from getter functions.
 matrices are available from getter functions.
 
 
-See this short example:
+Calculating the SVD is a very straightforward task.
+See this short example on how to use the SVD class:
 
 
 ```c++
 ```c++
 // Create a matrix
 // Create a matrix
@@ -31,3 +32,26 @@ NICE::MatrixT<double> result_s_matrix = svd.getS();
 // increased efficiency
 // increased efficiency
 NICE::VectorT<double> result_s_vector = svd.getSingularValues();
 NICE::VectorT<double> result_s_vector = svd.getSingularValues();
 ```
 ```
+
+## Eigenvalues
+-- add note about there being two ways to calculate eigenvectors --
+
+Calculating the eigenvalues of a matrix is as simple as single function call.
+The __eigenvalues__ function takes a _MatrixT<>_ and returns a _VectorT<>_ 
+that contains the eigenvalues. It allocates a _VectorT<>_ of matching dimensions
+on the heap.
+This behavior can be overridden be specifying a pointer as the second parameter.
+
+```c++
+// Create a matrix
+NICE::MatrixT<double> matrix(3,3,0);
+matrix.addIdentity(4);
+matrix(0,1) = -2;
+
+// Calculate the eigenvalues
+NICE::VectorT<double> eigenvals = NICE::eigenvalues(matrix);
+
+// ..or use your own vector
+NICE::VectorT<double> my_own_vector(3);
+NICE::eigenvalues(matrix, my_own_vector);
+```