aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-06-28 00:05:11 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-06-28 00:05:11 +0200
commitde1220aa62b8ec06dc608e86e023ce2b25658642 (patch)
tree6ef440698ac6f546a91fabe80f4ba7a13dde079a /doc/snippets
parentca29620e25be0d4a5f6dccd9a4c5c4c649cee35c (diff)
add a Transposition section in page 2
Diffstat (limited to 'doc/snippets')
-rw-r--r--doc/snippets/CMakeLists.txt2
-rw-r--r--doc/snippets/tut_arithmetic_transpose_aliasing.cpp4
-rw-r--r--doc/snippets/tut_arithmetic_transpose_conjugate.cpp12
-rw-r--r--doc/snippets/tut_arithmetic_transpose_inplace.cpp4
-rw-r--r--doc/snippets/tut_matrix_assignmnet_resizing.cpp5
5 files changed, 22 insertions, 5 deletions
diff --git a/doc/snippets/CMakeLists.txt b/doc/snippets/CMakeLists.txt
index fbddf2226..92a22ea61 100644
--- a/doc/snippets/CMakeLists.txt
+++ b/doc/snippets/CMakeLists.txt
@@ -26,3 +26,5 @@ foreach(snippet_src ${snippets_SRCS})
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
PROPERTIES OBJECT_DEPENDS ${snippet_src})
endforeach(snippet_src)
+
+ei_add_target_property(compile_tut_arithmetic_transpose_aliasing COMPILE_FLAGS -DEIGEN_NO_DEBUG) \ No newline at end of file
diff --git a/doc/snippets/tut_arithmetic_transpose_aliasing.cpp b/doc/snippets/tut_arithmetic_transpose_aliasing.cpp
new file mode 100644
index 000000000..dec2634a2
--- /dev/null
+++ b/doc/snippets/tut_arithmetic_transpose_aliasing.cpp
@@ -0,0 +1,4 @@
+Matrix2i a; a << 1, 2, 3, 4;
+cout << "Here is the matrix a:\n" << a << endl;
+a = a.transpose(); // fails
+cout << "and the aliasing effect:\n" << a << endl; \ No newline at end of file
diff --git a/doc/snippets/tut_arithmetic_transpose_conjugate.cpp b/doc/snippets/tut_arithmetic_transpose_conjugate.cpp
new file mode 100644
index 000000000..88496b22d
--- /dev/null
+++ b/doc/snippets/tut_arithmetic_transpose_conjugate.cpp
@@ -0,0 +1,12 @@
+MatrixXcf a = MatrixXcf::Random(2,2);
+cout << "Here is the matrix a\n" << a << endl;
+
+cout << "Here is the matrix a^T\n" << a.transpose() << endl;
+
+
+cout << "Here is the conjugate of a\n" << a.conjugate() << endl;
+
+
+cout << "Here is the matrix a^*\n" << a.adjoint() << endl;
+
+
diff --git a/doc/snippets/tut_arithmetic_transpose_inplace.cpp b/doc/snippets/tut_arithmetic_transpose_inplace.cpp
new file mode 100644
index 000000000..c46bd5b1a
--- /dev/null
+++ b/doc/snippets/tut_arithmetic_transpose_inplace.cpp
@@ -0,0 +1,4 @@
+MatrixXf a(2,3); a << 1, 2, 3, 4, 5, 6;
+cout << "Here is the initial matrix a:\n" << a << endl;
+a.transposeInPlace();
+cout << "and after being transposed:\n" << a << endl; \ No newline at end of file
diff --git a/doc/snippets/tut_matrix_assignmnet_resizing.cpp b/doc/snippets/tut_matrix_assignmnet_resizing.cpp
deleted file mode 100644
index 96b3c88d3..000000000
--- a/doc/snippets/tut_matrix_assignmnet_resizing.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-MatrixXf a(2,2);
-cout << "a is of size " << a.rows() << "x" << a.cols() << std::endl;
-MatrixXf b(3,3);
-a = b;
-cout << "a is now of size " << a.rows() << "x" << a.cols() << std::endl;