mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add a Transposition section in page 2
This commit is contained in:
@@ -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)
|
||||
4
doc/snippets/tut_arithmetic_transpose_aliasing.cpp
Normal file
4
doc/snippets/tut_arithmetic_transpose_aliasing.cpp
Normal file
@@ -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;
|
||||
12
doc/snippets/tut_arithmetic_transpose_conjugate.cpp
Normal file
12
doc/snippets/tut_arithmetic_transpose_conjugate.cpp
Normal file
@@ -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;
|
||||
|
||||
|
||||
4
doc/snippets/tut_arithmetic_transpose_inplace.cpp
Normal file
4
doc/snippets/tut_arithmetic_transpose_inplace.cpp
Normal file
@@ -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;
|
||||
@@ -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;
|
||||
Reference in New Issue
Block a user