Disabled external gits
This commit is contained in:
2
cs440-acg/ext/eigen/doc/snippets/.krazy
Normal file
2
cs440-acg/ext/eigen/doc/snippets/.krazy
Normal file
@@ -0,0 +1,2 @@
|
||||
EXCLUDE copyright
|
||||
EXCLUDE license
|
@@ -0,0 +1,5 @@
|
||||
Matrix3f m;
|
||||
m = AngleAxisf(0.25*M_PI, Vector3f::UnitX())
|
||||
* AngleAxisf(0.5*M_PI, Vector3f::UnitY())
|
||||
* AngleAxisf(0.33*M_PI, Vector3f::UnitZ());
|
||||
cout << m << endl << "is unitary: " << m.isUnitary() << endl;
|
11
cs440-acg/ext/eigen/doc/snippets/BiCGSTAB_simple.cpp
Normal file
11
cs440-acg/ext/eigen/doc/snippets/BiCGSTAB_simple.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
int n = 10000;
|
||||
VectorXd x(n), b(n);
|
||||
SparseMatrix<double> A(n,n);
|
||||
/* ... fill A and b ... */
|
||||
BiCGSTAB<SparseMatrix<double> > solver;
|
||||
solver.compute(A);
|
||||
x = solver.solve(b);
|
||||
std::cout << "#iterations: " << solver.iterations() << std::endl;
|
||||
std::cout << "estimated error: " << solver.error() << std::endl;
|
||||
/* ... update b ... */
|
||||
x = solver.solve(b); // solve again
|
14
cs440-acg/ext/eigen/doc/snippets/BiCGSTAB_step_by_step.cpp
Normal file
14
cs440-acg/ext/eigen/doc/snippets/BiCGSTAB_step_by_step.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
int n = 10000;
|
||||
VectorXd x(n), b(n);
|
||||
SparseMatrix<double> A(n,n);
|
||||
/* ... fill A and b ... */
|
||||
BiCGSTAB<SparseMatrix<double> > solver(A);
|
||||
// start from a random solution
|
||||
x = VectorXd::Random(n);
|
||||
solver.setMaxIterations(1);
|
||||
int i = 0;
|
||||
do {
|
||||
x = solver.solveWithGuess(b,x);
|
||||
std::cout << i << " : " << solver.error() << std::endl;
|
||||
++i;
|
||||
} while (solver.info()!=Success && i<100);
|
26
cs440-acg/ext/eigen/doc/snippets/CMakeLists.txt
Normal file
26
cs440-acg/ext/eigen/doc/snippets/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
file(GLOB snippets_SRCS "*.cpp")
|
||||
|
||||
add_custom_target(all_snippets)
|
||||
|
||||
foreach(snippet_src ${snippets_SRCS})
|
||||
get_filename_component(snippet ${snippet_src} NAME_WE)
|
||||
set(compile_snippet_target compile_${snippet})
|
||||
set(compile_snippet_src ${compile_snippet_target}.cpp)
|
||||
file(READ ${snippet_src} snippet_source_code)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/compile_snippet.cpp.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
add_executable(${compile_snippet_target}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src})
|
||||
if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)
|
||||
target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})
|
||||
endif()
|
||||
add_custom_command(
|
||||
TARGET ${compile_snippet_target}
|
||||
POST_BUILD
|
||||
COMMAND ${compile_snippet_target}
|
||||
ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out
|
||||
)
|
||||
add_dependencies(all_snippets ${compile_snippet_target})
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}
|
||||
PROPERTIES OBJECT_DEPENDS ${snippet_src})
|
||||
endforeach(snippet_src)
|
@@ -0,0 +1,8 @@
|
||||
Matrix3f m = Matrix3f::Random();
|
||||
Matrix3f y = Matrix3f::Random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is the matrix y:" << endl << y << endl;
|
||||
Matrix3f x;
|
||||
x = m.colPivHouseholderQr().solve(y);
|
||||
assert(y.isApprox(m*x));
|
||||
cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
|
@@ -0,0 +1,16 @@
|
||||
MatrixXcf A = MatrixXcf::Random(4,4);
|
||||
cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
|
||||
|
||||
ComplexEigenSolver<MatrixXcf> ces;
|
||||
ces.compute(A);
|
||||
cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl;
|
||||
cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl;
|
||||
|
||||
complex<float> lambda = ces.eigenvalues()[0];
|
||||
cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
|
||||
VectorXcf v = ces.eigenvectors().col(0);
|
||||
cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
|
||||
cout << "... and A * v = " << endl << A * v << endl << endl;
|
||||
|
||||
cout << "Finally, V * D * V^(-1) = " << endl
|
||||
<< ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXcf ones = MatrixXcf::Ones(3,3);
|
||||
ComplexEigenSolver<MatrixXcf> ces(ones, /* computeEigenvectors = */ false);
|
||||
cout << "The eigenvalues of the 3x3 matrix of ones are:"
|
||||
<< endl << ces.eigenvalues() << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXcf ones = MatrixXcf::Ones(3,3);
|
||||
ComplexEigenSolver<MatrixXcf> ces(ones);
|
||||
cout << "The first eigenvector of the 3x3 matrix of ones is:"
|
||||
<< endl << ces.eigenvectors().col(1) << endl;
|
@@ -0,0 +1,6 @@
|
||||
MatrixXcf A = MatrixXcf::Random(4,4);
|
||||
ComplexSchur<MatrixXcf> schur(4);
|
||||
schur.compute(A);
|
||||
cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl;
|
||||
schur.compute(A.inverse());
|
||||
cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXcf A = MatrixXcf::Random(4,4);
|
||||
cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
|
||||
ComplexSchur<MatrixXcf> schurOfA(A, false); // false means do not compute U
|
||||
cout << "The triangular matrix T is:" << endl << schurOfA.matrixT() << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXcf A = MatrixXcf::Random(4,4);
|
||||
cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
|
||||
ComplexSchur<MatrixXcf> schurOfA(A);
|
||||
cout << "The unitary matrix U is:" << endl << schurOfA.matrixU() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_abs.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_abs.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,-2,-3);
|
||||
cout << v.abs() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_abs2.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_abs2.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,-2,-3);
|
||||
cout << v.abs2() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_acos.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_acos.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(0, sqrt(2.)/2, 1);
|
||||
cout << v.acos() << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_arg.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_arg.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
ArrayXcf v = ArrayXcf::Random(3);
|
||||
cout << v << endl << endl;
|
||||
cout << arg(v) << endl;
|
@@ -0,0 +1,4 @@
|
||||
Array<double,1,3> x(8,25,3),
|
||||
e(1./3.,0.5,2.);
|
||||
cout << "[" << x << "]^[" << e << "] = " << x.pow(e) << endl; // using ArrayBase::pow
|
||||
cout << "[" << x << "]^[" << e << "] = " << pow(x,e) << endl; // using Eigen::pow
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_asin.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_asin.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(0, sqrt(2.)/2, 1);
|
||||
cout << v.asin() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_atan.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_atan.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(5,0,1);
|
||||
cout << v.atan() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_and.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_and.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(-1,2,1), w(-3,2,3);
|
||||
cout << ((v<w) && (v<0)) << endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_not.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_not.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
Array3d v(1,2,3);
|
||||
v(1) *= 0.0/0.0;
|
||||
v(2) /= 0.0;
|
||||
cout << v << endl << endl;
|
||||
cout << !isfinite(v) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_or.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_or.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(-1,2,1), w(-3,2,3);
|
||||
cout << ((v<w) || (v<0)) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_xor.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_boolean_xor.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(-1,2,1), w(-3,2,3);
|
||||
cout << ((v<w) ^ (v<0)) << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_ceil.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_ceil.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(7,-2,2);
|
||||
cout << v << endl << endl;
|
||||
cout << ceil(v) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_cos.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_cos.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(M_PI, M_PI/2, M_PI/3);
|
||||
cout << v.cos() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_cosh.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_cosh.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(5,0,1);
|
||||
cout << cosh(v) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_cube.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_cube.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(2,3,4);
|
||||
cout << v.cube() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_equal_equal.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_equal_equal.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3), w(3,2,1);
|
||||
cout << (v==w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_exp.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_exp.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3);
|
||||
cout << v.exp() << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_floor.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_floor.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(7,-2,2);
|
||||
cout << v << endl << endl;
|
||||
cout << floor(v) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_greater.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_greater.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3), w(3,2,1);
|
||||
cout << (v>w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_greater_equal.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_greater_equal.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3), w(3,2,1);
|
||||
cout << (v>=w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_inverse.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_inverse.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(2,3,4);
|
||||
cout << v.inverse() << endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Cwise_isFinite.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Cwise_isFinite.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
Array3d v(1,2,3);
|
||||
v(1) *= 0.0/0.0;
|
||||
v(2) /= 0.0;
|
||||
cout << v << endl << endl;
|
||||
cout << isfinite(v) << endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Cwise_isInf.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Cwise_isInf.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
Array3d v(1,2,3);
|
||||
v(1) *= 0.0/0.0;
|
||||
v(2) /= 0.0;
|
||||
cout << v << endl << endl;
|
||||
cout << isinf(v) << endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Cwise_isNaN.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Cwise_isNaN.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
Array3d v(1,2,3);
|
||||
v(1) *= 0.0/0.0;
|
||||
v(2) /= 0.0;
|
||||
cout << v << endl << endl;
|
||||
cout << isnan(v) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_less.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_less.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3), w(3,2,1);
|
||||
cout << (v<w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_less_equal.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_less_equal.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3), w(3,2,1);
|
||||
cout << (v<=w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_log.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_log.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3);
|
||||
cout << v.log() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_log10.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_log10.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array4d v(-1,0,1,2);
|
||||
cout << log10(v) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_max.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_max.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(2,3,4), w(4,2,3);
|
||||
cout << v.max(w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_min.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_min.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(2,3,4), w(4,2,3);
|
||||
cout << v.min(w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_minus.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_minus.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3);
|
||||
cout << v-5 << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_minus_equal.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_minus_equal.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Array3d v(1,2,3);
|
||||
v -= 5;
|
||||
cout << v << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_not_equal.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_not_equal.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3), w(3,2,1);
|
||||
cout << (v!=w) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_plus.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_plus.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,3);
|
||||
cout << v+5 << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_plus_equal.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_plus_equal.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Array3d v(1,2,3);
|
||||
v += 5;
|
||||
cout << v << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_pow.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_pow.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(8,27,64);
|
||||
cout << v.pow(0.333333) << endl;
|
4
cs440-acg/ext/eigen/doc/snippets/Cwise_product.cpp
Normal file
4
cs440-acg/ext/eigen/doc/snippets/Cwise_product.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
Array33i a = Array33i::Random(), b = Array33i::Random();
|
||||
Array33i c = a * b;
|
||||
cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl;
|
||||
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_quotient.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_quotient.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(2,3,4), w(4,2,3);
|
||||
cout << v/w << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_round.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_round.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(7,-2,2);
|
||||
cout << v << endl << endl;
|
||||
cout << round(v) << endl;
|
@@ -0,0 +1,2 @@
|
||||
Array<double,1,3> e(2,-3,1./3.);
|
||||
cout << "10^[" << e << "] = " << pow(10,e) << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sign.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sign.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(-3,5,0);
|
||||
cout << v.sign() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sin.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sin.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(M_PI, M_PI/2, M_PI/3);
|
||||
cout << v.sin() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sinh.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sinh.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(5,0,1);
|
||||
cout << sinh(v) << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_slash_equal.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_slash_equal.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Array3d v(3,2,4), w(5,4,2);
|
||||
v /= w;
|
||||
cout << v << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sqrt.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_sqrt.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(1,2,4);
|
||||
cout << v.sqrt() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_square.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_square.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(2,3,4);
|
||||
cout << v.square() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_tan.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_tan.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
Array3d v(M_PI, M_PI/2, M_PI/3);
|
||||
cout << v.tan() << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/Cwise_tanh.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/Cwise_tanh.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
ArrayXd v = ArrayXd::LinSpaced(5,0,1);
|
||||
cout << tanh(v) << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Cwise_times_equal.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Cwise_times_equal.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Array3d v(1,2,3), w(2,3,0);
|
||||
v *= w;
|
||||
cout << v << endl;
|
2
cs440-acg/ext/eigen/doc/snippets/DenseBase_LinSpaced.cpp
Normal file
2
cs440-acg/ext/eigen/doc/snippets/DenseBase_LinSpaced.cpp
Normal file
@@ -0,0 +1,2 @@
|
||||
cout << VectorXi::LinSpaced(4,7,10).transpose() << endl;
|
||||
cout << VectorXd::LinSpaced(5,0.0,1.0).transpose() << endl;
|
@@ -0,0 +1,8 @@
|
||||
cout << "Even spacing inputs:" << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,4).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,8).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,15).transpose() << endl;
|
||||
cout << "Uneven spacing inputs:" << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,7).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,9).transpose() << endl;
|
||||
cout << VectorXi::LinSpaced(8,1,16).transpose() << endl;
|
@@ -0,0 +1,2 @@
|
||||
cout << VectorXi::LinSpaced(Sequential,4,7,10).transpose() << endl;
|
||||
cout << VectorXd::LinSpaced(Sequential,5,0.0,1.0).transpose() << endl;
|
@@ -0,0 +1,3 @@
|
||||
VectorXf v;
|
||||
v.setLinSpaced(5,0.5f,1.5f);
|
||||
cout << v << endl;
|
@@ -0,0 +1,7 @@
|
||||
typedef Matrix<double,4,Dynamic> Matrix4Xd;
|
||||
Matrix4Xd M = Matrix4Xd::Random(4,5);
|
||||
Projective3d P(Matrix4d::Random());
|
||||
cout << "The matrix M is:" << endl << M << endl << endl;
|
||||
cout << "M.colwise().hnormalized():" << endl << M.colwise().hnormalized() << endl << endl;
|
||||
cout << "P*M:" << endl << P*M << endl << endl;
|
||||
cout << "(P*M).colwise().hnormalized():" << endl << (P*M).colwise().hnormalized() << endl << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXi m = MatrixXi::Random(2,3);
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "m.colwise().replicate<3>() = ..." << endl;
|
||||
cout << m.colwise().replicate<3>() << endl;
|
@@ -0,0 +1,4 @@
|
||||
Vector3i v = Vector3i::Random();
|
||||
cout << "Here is the vector v:" << endl << v << endl;
|
||||
cout << "v.rowwise().replicate(5) = ..." << endl;
|
||||
cout << v.rowwise().replicate(5) << endl;
|
@@ -0,0 +1,16 @@
|
||||
MatrixXd A = MatrixXd::Random(6,6);
|
||||
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
|
||||
|
||||
EigenSolver<MatrixXd> es(A);
|
||||
cout << "The eigenvalues of A are:" << endl << es.eigenvalues() << endl;
|
||||
cout << "The matrix of eigenvectors, V, is:" << endl << es.eigenvectors() << endl << endl;
|
||||
|
||||
complex<double> lambda = es.eigenvalues()[0];
|
||||
cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
|
||||
VectorXcd v = es.eigenvectors().col(0);
|
||||
cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
|
||||
cout << "... and A * v = " << endl << A.cast<complex<double> >() * v << endl << endl;
|
||||
|
||||
MatrixXcd D = es.eigenvalues().asDiagonal();
|
||||
MatrixXcd V = es.eigenvectors();
|
||||
cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl;
|
6
cs440-acg/ext/eigen/doc/snippets/EigenSolver_compute.cpp
Normal file
6
cs440-acg/ext/eigen/doc/snippets/EigenSolver_compute.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
EigenSolver<MatrixXf> es;
|
||||
MatrixXf A = MatrixXf::Random(4,4);
|
||||
es.compute(A, /* computeEigenvectors = */ false);
|
||||
cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl;
|
||||
es.compute(A + MatrixXf::Identity(4,4), false); // re-use es to compute eigenvalues of A+I
|
||||
cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXd ones = MatrixXd::Ones(3,3);
|
||||
EigenSolver<MatrixXd> es(ones, false);
|
||||
cout << "The eigenvalues of the 3x3 matrix of ones are:"
|
||||
<< endl << es.eigenvalues() << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXd ones = MatrixXd::Ones(3,3);
|
||||
EigenSolver<MatrixXd> es(ones);
|
||||
cout << "The first eigenvector of the 3x3 matrix of ones is:"
|
||||
<< endl << es.eigenvectors().col(0) << endl;
|
@@ -0,0 +1,9 @@
|
||||
MatrixXd A = MatrixXd::Random(6,6);
|
||||
cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;
|
||||
|
||||
EigenSolver<MatrixXd> es(A);
|
||||
MatrixXd D = es.pseudoEigenvalueMatrix();
|
||||
MatrixXd V = es.pseudoEigenvectors();
|
||||
cout << "The pseudo-eigenvalue matrix D is:" << endl << D << endl;
|
||||
cout << "The pseudo-eigenvector matrix V is:" << endl << V << endl;
|
||||
cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl;
|
@@ -0,0 +1,8 @@
|
||||
Matrix3f m = Matrix3f::Random();
|
||||
Matrix3f y = Matrix3f::Random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is the matrix y:" << endl << y << endl;
|
||||
Matrix3f x;
|
||||
x = m.fullPivHouseholderQr().solve(y);
|
||||
assert(y.isApprox(m*x));
|
||||
cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
|
9
cs440-acg/ext/eigen/doc/snippets/FullPivLU_image.cpp
Normal file
9
cs440-acg/ext/eigen/doc/snippets/FullPivLU_image.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
Matrix3d m;
|
||||
m << 1,1,0,
|
||||
1,3,2,
|
||||
0,1,1;
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Notice that the middle column is the sum of the two others, so the "
|
||||
<< "columns are linearly dependent." << endl;
|
||||
cout << "Here is a matrix whose columns have the same span but are linearly independent:"
|
||||
<< endl << m.fullPivLu().image(m) << endl;
|
7
cs440-acg/ext/eigen/doc/snippets/FullPivLU_kernel.cpp
Normal file
7
cs440-acg/ext/eigen/doc/snippets/FullPivLU_kernel.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
MatrixXf m = MatrixXf::Random(3,5);
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
MatrixXf ker = m.fullPivLu().kernel();
|
||||
cout << "Here is a matrix whose columns form a basis of the kernel of m:"
|
||||
<< endl << ker << endl;
|
||||
cout << "By definition of the kernel, m*ker is zero:"
|
||||
<< endl << m*ker << endl;
|
11
cs440-acg/ext/eigen/doc/snippets/FullPivLU_solve.cpp
Normal file
11
cs440-acg/ext/eigen/doc/snippets/FullPivLU_solve.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
Matrix<float,2,3> m = Matrix<float,2,3>::Random();
|
||||
Matrix2f y = Matrix2f::Random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is the matrix y:" << endl << y << endl;
|
||||
Matrix<float,3,2> x = m.fullPivLu().solve(y);
|
||||
if((m*x).isApprox(y))
|
||||
{
|
||||
cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
|
||||
}
|
||||
else
|
||||
cout << "The equation mx=y does not have any solution." << endl;
|
@@ -0,0 +1,7 @@
|
||||
GeneralizedEigenSolver<MatrixXf> ges;
|
||||
MatrixXf A = MatrixXf::Random(4,4);
|
||||
MatrixXf B = MatrixXf::Random(4,4);
|
||||
ges.compute(A, B);
|
||||
cout << "The (complex) numerators of the generalzied eigenvalues are: " << ges.alphas().transpose() << endl;
|
||||
cout << "The (real) denominatore of the generalzied eigenvalues are: " << ges.betas().transpose() << endl;
|
||||
cout << "The (complex) generalzied eigenvalues are (alphas./beta): " << ges.eigenvalues().transpose() << endl;
|
@@ -0,0 +1,6 @@
|
||||
MatrixXcf A = MatrixXcf::Random(4,4);
|
||||
HessenbergDecomposition<MatrixXcf> hd(4);
|
||||
hd.compute(A);
|
||||
cout << "The matrix H in the decomposition of A is:" << endl << hd.matrixH() << endl;
|
||||
hd.compute(2*A); // re-use hd to compute and store decomposition of 2A
|
||||
cout << "The matrix H in the decomposition of 2A is:" << endl << hd.matrixH() << endl;
|
@@ -0,0 +1,8 @@
|
||||
Matrix4f A = MatrixXf::Random(4,4);
|
||||
cout << "Here is a random 4x4 matrix:" << endl << A << endl;
|
||||
HessenbergDecomposition<MatrixXf> hessOfA(A);
|
||||
MatrixXf H = hessOfA.matrixH();
|
||||
cout << "The Hessenberg matrix H is:" << endl << H << endl;
|
||||
MatrixXf Q = hessOfA.matrixQ();
|
||||
cout << "The orthogonal matrix Q is:" << endl << Q << endl;
|
||||
cout << "Q H Q^T is:" << endl << Q * H * Q.transpose() << endl;
|
@@ -0,0 +1,9 @@
|
||||
Matrix4d A = Matrix4d::Random(4,4);
|
||||
cout << "Here is a random 4x4 matrix:" << endl << A << endl;
|
||||
HessenbergDecomposition<Matrix4d> hessOfA(A);
|
||||
Matrix4d pm = hessOfA.packedMatrix();
|
||||
cout << "The packed matrix M is:" << endl << pm << endl;
|
||||
cout << "The upper Hessenberg part corresponds to the matrix H, which is:"
|
||||
<< endl << hessOfA.matrixH() << endl;
|
||||
Vector3d hc = hessOfA.householderCoefficients();
|
||||
cout << "The vector of Householder coefficients is:" << endl << hc << endl;
|
@@ -0,0 +1,7 @@
|
||||
MatrixXf A(MatrixXf::Random(5,3)), thinQ(MatrixXf::Identity(5,3)), Q;
|
||||
A.setRandom();
|
||||
HouseholderQR<MatrixXf> qr(A);
|
||||
Q = qr.householderQ();
|
||||
thinQ = qr.householderQ() * thinQ;
|
||||
std::cout << "The complete unitary matrix Q is:\n" << Q << "\n\n";
|
||||
std::cout << "The thin matrix Q is:\n" << thinQ << "\n\n";
|
9
cs440-acg/ext/eigen/doc/snippets/HouseholderQR_solve.cpp
Normal file
9
cs440-acg/ext/eigen/doc/snippets/HouseholderQR_solve.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
typedef Matrix<float,3,3> Matrix3x3;
|
||||
Matrix3x3 m = Matrix3x3::Random();
|
||||
Matrix3f y = Matrix3f::Random();
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
cout << "Here is the matrix y:" << endl << y << endl;
|
||||
Matrix3f x;
|
||||
x = m.householderQr().solve(y);
|
||||
assert(y.isApprox(m*x));
|
||||
cout << "Here is a solution x to the equation mx=y:" << endl << x << endl;
|
@@ -0,0 +1,31 @@
|
||||
Matrix3d v = Matrix3d::Random();
|
||||
cout << "The matrix v is:" << endl;
|
||||
cout << v << endl;
|
||||
|
||||
Vector3d v0(1, v(1,0), v(2,0));
|
||||
cout << "The first Householder vector is: v_0 = " << v0.transpose() << endl;
|
||||
Vector3d v1(0, 1, v(2,1));
|
||||
cout << "The second Householder vector is: v_1 = " << v1.transpose() << endl;
|
||||
Vector3d v2(0, 0, 1);
|
||||
cout << "The third Householder vector is: v_2 = " << v2.transpose() << endl;
|
||||
|
||||
Vector3d h = Vector3d::Random();
|
||||
cout << "The Householder coefficients are: h = " << h.transpose() << endl;
|
||||
|
||||
Matrix3d H0 = Matrix3d::Identity() - h(0) * v0 * v0.adjoint();
|
||||
cout << "The first Householder reflection is represented by H_0 = " << endl;
|
||||
cout << H0 << endl;
|
||||
Matrix3d H1 = Matrix3d::Identity() - h(1) * v1 * v1.adjoint();
|
||||
cout << "The second Householder reflection is represented by H_1 = " << endl;
|
||||
cout << H1 << endl;
|
||||
Matrix3d H2 = Matrix3d::Identity() - h(2) * v2 * v2.adjoint();
|
||||
cout << "The third Householder reflection is represented by H_2 = " << endl;
|
||||
cout << H2 << endl;
|
||||
cout << "Their product is H_0 H_1 H_2 = " << endl;
|
||||
cout << H0 * H1 * H2 << endl;
|
||||
|
||||
HouseholderSequence<Matrix3d, Vector3d> hhSeq(v, h);
|
||||
Matrix3d hhSeqAsMatrix(hhSeq);
|
||||
cout << "If we construct a HouseholderSequence from v and h" << endl;
|
||||
cout << "and convert it to a matrix, we get:" << endl;
|
||||
cout << hhSeqAsMatrix << endl;
|
14
cs440-acg/ext/eigen/doc/snippets/IOFormat.cpp
Normal file
14
cs440-acg/ext/eigen/doc/snippets/IOFormat.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
std::string sep = "\n----------------------------------------\n";
|
||||
Matrix3d m1;
|
||||
m1 << 1.111111, 2, 3.33333, 4, 5, 6, 7, 8.888888, 9;
|
||||
|
||||
IOFormat CommaInitFmt(StreamPrecision, DontAlignCols, ", ", ", ", "", "", " << ", ";");
|
||||
IOFormat CleanFmt(4, 0, ", ", "\n", "[", "]");
|
||||
IOFormat OctaveFmt(StreamPrecision, 0, ", ", ";\n", "", "", "[", "]");
|
||||
IOFormat HeavyFmt(FullPrecision, 0, ", ", ";\n", "[", "]", "[", "]");
|
||||
|
||||
std::cout << m1 << sep;
|
||||
std::cout << m1.format(CommaInitFmt) << sep;
|
||||
std::cout << m1.format(CleanFmt) << sep;
|
||||
std::cout << m1.format(OctaveFmt) << sep;
|
||||
std::cout << m1.format(HeavyFmt) << sep;
|
9
cs440-acg/ext/eigen/doc/snippets/JacobiSVD_basic.cpp
Normal file
9
cs440-acg/ext/eigen/doc/snippets/JacobiSVD_basic.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
MatrixXf m = MatrixXf::Random(3,2);
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
JacobiSVD<MatrixXf> svd(m, ComputeThinU | ComputeThinV);
|
||||
cout << "Its singular values are:" << endl << svd.singularValues() << endl;
|
||||
cout << "Its left singular vectors are the columns of the thin U matrix:" << endl << svd.matrixU() << endl;
|
||||
cout << "Its right singular vectors are the columns of the thin V matrix:" << endl << svd.matrixV() << endl;
|
||||
Vector3f rhs(1, 0, 0);
|
||||
cout << "Now consider this rhs vector:" << endl << rhs << endl;
|
||||
cout << "A least-squares solution of m*x = rhs is:" << endl << svd.solve(rhs) << endl;
|
6
cs440-acg/ext/eigen/doc/snippets/Jacobi_makeGivens.cpp
Normal file
6
cs440-acg/ext/eigen/doc/snippets/Jacobi_makeGivens.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
Vector2f v = Vector2f::Random();
|
||||
JacobiRotation<float> G;
|
||||
G.makeGivens(v.x(), v.y());
|
||||
cout << "Here is the vector v:" << endl << v << endl;
|
||||
v.applyOnTheLeft(0, 1, G.adjoint());
|
||||
cout << "Here is the vector J' * v:" << endl << v << endl;
|
8
cs440-acg/ext/eigen/doc/snippets/Jacobi_makeJacobi.cpp
Normal file
8
cs440-acg/ext/eigen/doc/snippets/Jacobi_makeJacobi.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
Matrix2f m = Matrix2f::Random();
|
||||
m = (m + m.adjoint()).eval();
|
||||
JacobiRotation<float> J;
|
||||
J.makeJacobi(m, 0, 1);
|
||||
cout << "Here is the matrix m:" << endl << m << endl;
|
||||
m.applyOnTheLeft(0, 1, J.adjoint());
|
||||
m.applyOnTheRight(0, 1, J);
|
||||
cout << "Here is the matrix J' * m * J:" << endl << m << endl;
|
12
cs440-acg/ext/eigen/doc/snippets/LLT_example.cpp
Normal file
12
cs440-acg/ext/eigen/doc/snippets/LLT_example.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
MatrixXd A(3,3);
|
||||
A << 4,-1,2, -1,6,0, 2,0,5;
|
||||
cout << "The matrix A is" << endl << A << endl;
|
||||
|
||||
LLT<MatrixXd> lltOfA(A); // compute the Cholesky decomposition of A
|
||||
MatrixXd L = lltOfA.matrixL(); // retrieve factor L in the decomposition
|
||||
// The previous two lines can also be written as "L = A.llt().matrixL()"
|
||||
|
||||
cout << "The Cholesky factor L is" << endl << L << endl;
|
||||
cout << "To check this, let us compute L * L.transpose()" << endl;
|
||||
cout << L * L.transpose() << endl;
|
||||
cout << "This should equal the matrix A" << endl;
|
8
cs440-acg/ext/eigen/doc/snippets/LLT_solve.cpp
Normal file
8
cs440-acg/ext/eigen/doc/snippets/LLT_solve.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
typedef Matrix<float,Dynamic,2> DataMatrix;
|
||||
// let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise)
|
||||
DataMatrix samples = DataMatrix::Random(12,2);
|
||||
VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1;
|
||||
// and let's solve samples * [x y]^T = elevations in least square sense:
|
||||
Matrix<float,2,1> xy
|
||||
= (samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations));
|
||||
cout << xy << endl;
|
@@ -0,0 +1,4 @@
|
||||
MatrixXf A = MatrixXf::Random(3, 2);
|
||||
VectorXf b = VectorXf::Random(3);
|
||||
cout << "The solution using normal equations is:\n"
|
||||
<< (A.transpose() * A).ldlt().solve(A.transpose() * b) << endl;
|
4
cs440-acg/ext/eigen/doc/snippets/LeastSquaresQR.cpp
Normal file
4
cs440-acg/ext/eigen/doc/snippets/LeastSquaresQR.cpp
Normal file
@@ -0,0 +1,4 @@
|
||||
MatrixXf A = MatrixXf::Random(3, 2);
|
||||
VectorXf b = VectorXf::Random(3);
|
||||
cout << "The solution using the QR decomposition is:\n"
|
||||
<< A.colPivHouseholderQr().solve(b) << endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Map_general_stride.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Map_general_stride.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
int array[24];
|
||||
for(int i = 0; i < 24; ++i) array[i] = i;
|
||||
cout << Map<MatrixXi, 0, Stride<Dynamic,2> >
|
||||
(array, 3, 3, Stride<Dynamic,2>(8, 2))
|
||||
<< endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Map_inner_stride.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Map_inner_stride.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
int array[12];
|
||||
for(int i = 0; i < 12; ++i) array[i] = i;
|
||||
cout << Map<VectorXi, 0, InnerStride<2> >
|
||||
(array, 6) // the inner stride has already been passed as template parameter
|
||||
<< endl;
|
3
cs440-acg/ext/eigen/doc/snippets/Map_outer_stride.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Map_outer_stride.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
int array[12];
|
||||
for(int i = 0; i < 12; ++i) array[i] = i;
|
||||
cout << Map<MatrixXi, 0, OuterStride<> >(array, 3, 3, OuterStride<>(4)) << endl;
|
5
cs440-acg/ext/eigen/doc/snippets/Map_placement_new.cpp
Normal file
5
cs440-acg/ext/eigen/doc/snippets/Map_placement_new.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
int data[] = {1,2,3,4,5,6,7,8,9};
|
||||
Map<RowVectorXi> v(data,4);
|
||||
cout << "The mapped vector v is: " << v << "\n";
|
||||
new (&v) Map<RowVectorXi>(data+4,5);
|
||||
cout << "Now v is: " << v << "\n";
|
3
cs440-acg/ext/eigen/doc/snippets/Map_simple.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/Map_simple.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
int array[9];
|
||||
for(int i = 0; i < 9; ++i) array[i] = i;
|
||||
cout << Map<Matrix3i>(array) << endl;
|
3
cs440-acg/ext/eigen/doc/snippets/MatrixBase_adjoint.cpp
Normal file
3
cs440-acg/ext/eigen/doc/snippets/MatrixBase_adjoint.cpp
Normal file
@@ -0,0 +1,3 @@
|
||||
Matrix2cf m = Matrix2cf::Random();
|
||||
cout << "Here is the 2x2 complex matrix m:" << endl << m << endl;
|
||||
cout << "Here is the adjoint of m:" << endl << m.adjoint() << endl;
|
7
cs440-acg/ext/eigen/doc/snippets/MatrixBase_all.cpp
Normal file
7
cs440-acg/ext/eigen/doc/snippets/MatrixBase_all.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones());
|
||||
Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs();
|
||||
// let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax:
|
||||
cout << "Is (" << p0.transpose() << ") inside the box: "
|
||||
<< ((boxMin.array()<p0.array()).all() && (boxMax.array()>p0.array()).all()) << endl;
|
||||
cout << "Is (" << p1.transpose() << ") inside the box: "
|
||||
<< ((boxMin.array()<p1.array()).all() && (boxMax.array()>p1.array()).all()) << endl;
|
@@ -0,0 +1,7 @@
|
||||
Matrix3f A = Matrix3f::Random(3,3), B;
|
||||
B << 0,1,0,
|
||||
0,0,1,
|
||||
1,0,0;
|
||||
cout << "At start, A = " << endl << A << endl;
|
||||
A.applyOnTheLeft(B);
|
||||
cout << "After applyOnTheLeft, A = " << endl << A << endl;
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user