keyword
stringclasses 7
values | repo_name
stringlengths 8
98
| file_path
stringlengths 4
244
| file_extension
stringclasses 29
values | file_size
int64 0
84.1M
| line_count
int64 0
1.6M
| content
stringlengths 1
84.1M
⌀ | language
stringclasses 14
values |
|---|---|---|---|---|---|---|---|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_square.cpp
|
.cpp
| 46
| 3
|
Array3d v(2,3,4);
cout << v.square() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_log10.cpp
|
.cpp
| 47
| 3
|
Array4d v(-1,0,1,2);
cout << log10(v) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_less_equal.cpp
|
.cpp
| 52
| 3
|
Array3d v(1,2,3), w(3,2,1);
cout << (v<=w) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_cwiseSqrt.cpp
|
.cpp
| 50
| 3
|
Vector3d v(1,2,4);
cout << v.cwiseSqrt() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_isNaN.cpp
|
.cpp
| 101
| 6
|
Array3d v(1,2,3);
v(1) *= 0.0/0.0;
v(2) /= 0.0;
cout << v << endl << endl;
cout << isnan(v) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_zero_int_int.cpp
|
.cpp
| 37
| 2
|
cout << MatrixXi::Zero(2,3) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tutorial_solve_reuse_decomposition.cpp
|
.cpp
| 368
| 14
|
Matrix3f A(3,3);
A << 1,2,3, 4,5,6, 7,8,10;
PartialPivLU<Matrix3f> luOfA(A); // compute LU decomposition of A
Vector3f b;
b << 3,3,4;
Vector3f x;
x = luOfA.solve(b);
cout << "The solution with right-hand side (3,3,4) is:" << endl;
cout << x << endl;
b << 1,1,1;
x = luOfA.solve(b);
cout << "The solution with right-hand side (1,1,1) is:" << endl;
cout << x << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_adjoint.cpp
|
.cpp
| 169
| 4
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_eigenvalues.cpp
|
.cpp
| 160
| 4
|
MatrixXd ones = MatrixXd::Ones(3,3);
VectorXcd eivals = ones.eigenvalues();
cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Matrix_resize_int.cpp
|
.cpp
| 235
| 7
|
VectorXd v(10);
v.resize(3);
RowVector3d w;
w.resize(3); // this is legal, but has no effect
cout << "v: " << v.rows() << " rows, " << v.cols() << " cols" << endl;
cout << "w: " << w.rows() << " rows, " << w.cols() << " cols" << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Jacobi_makeGivens.cpp
|
.cpp
| 235
| 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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/SelfAdjointView_eigenvalues.cpp
|
.cpp
| 184
| 4
|
MatrixXd ones = MatrixXd::Ones(3,3);
VectorXd eivals = ones.selfadjointView<Lower>().eigenvalues();
cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_cwiseSign.cpp
|
.cpp
| 80
| 5
|
MatrixXd m(2,3);
m << 2, -4, 6,
-5, 1, 0;
cout << m.cwiseSign() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_random_int.cpp
|
.cpp
| 37
| 2
|
cout << VectorXi::Random(2) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/TopicAliasing_mult5.cpp
|
.cpp
| 109
| 6
|
MatrixXf A(2,2), B(3,2);
B << 2, 0, 0, 3, 1, 1;
A << 2, 0, 0, -2;
A = (B * A).eval().cwiseAbs();
cout << A;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tutorial_commainit_01b.cpp
|
.cpp
| 113
| 6
|
Matrix3f m;
m.row(0) << 1, 2, 3;
m.block(1,0,2,2) << 4, 5, 7, 8;
m.col(2).tail(2) << 6, 9;
std::cout << m;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Map_general_stride.cpp
|
.cpp
| 164
| 6
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_rowwise.cpp
|
.cpp
| 281
| 6
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl;
cout << "Here is the maximum absolute value of each row:"
<< endl << m.cwiseAbs().rowwise().maxCoeff() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp
|
.cpp
| 363
| 9
|
MatrixXd X = MatrixXd::Random(4,4);
MatrixXd A = X * X.transpose();
cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
MatrixXd sqrtA = es.operatorSqrt();
cout << "The square root of A is: " << endl << sqrtA << endl;
cout << "If we square this, we get: " << endl << sqrtA*sqrtA << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_slash_equal.cpp
|
.cpp
| 55
| 4
|
Array3d v(3,2,4), w(5,4,2);
v /= w;
cout << v << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp
|
.cpp
| 878
| 21
|
const int size = 6;
MatrixXd mat1(size, size);
mat1.topLeftCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2);
mat1.topRightCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2);
mat1.bottomLeftCorner(size/2, size/2) = MatrixXd::Identity(size/2, size/2);
mat1.bottomRightCorner(size/2, size/2) = MatrixXd::Zero(size/2, size/2);
std::cout << mat1 << std::endl << std::endl;
MatrixXd mat2(size, size);
mat2.topLeftCorner(size/2, size/2).setZero();
mat2.topRightCorner(size/2, size/2).setIdentity();
mat2.bottomLeftCorner(size/2, size/2).setIdentity();
mat2.bottomRightCorner(size/2, size/2).setZero();
std::cout << mat2 << std::endl << std::endl;
MatrixXd mat3(size, size);
mat3 << MatrixXd::Zero(size/2, size/2), MatrixXd::Identity(size/2, size/2),
MatrixXd::Identity(size/2, size/2), MatrixXd::Zero(size/2, size/2);
std::cout << mat3 << std::endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/PartialRedux_maxCoeff.cpp
|
.cpp
| 176
| 4
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the maximum of each column:" << endl << m.colwise().maxCoeff() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_identity_int_int.cpp
|
.cpp
| 42
| 2
|
cout << MatrixXd::Identity(4, 3) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/TopicAliasing_block.cpp
|
.cpp
| 267
| 8
|
MatrixXi mat(3,3);
mat << 1, 2, 3, 4, 5, 6, 7, 8, 9;
cout << "Here is the matrix mat:\n" << mat << endl;
// This assignment shows the aliasing problem
mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2);
cout << "After the assignment, mat = \n" << mat << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_fixedBlock_int_int.cpp
|
.cpp
| 274
| 6
|
Matrix4d m = Vector4d(1,2,3,4).asDiagonal();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is m.fixed<2, 2>(2, 2):" << endl << m.block<2, 2>(2, 2) << endl;
m.block<2, 2>(2, 0) = m.block<2, 2>(2, 2);
cout << "Now the matrix m is:" << endl << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_all.cpp
|
.cpp
| 523
| 8
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/PartialRedux_minCoeff.cpp
|
.cpp
| 176
| 4
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the minimum of each column:" << endl << m.colwise().minCoeff() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_template_int_rightCols.cpp
|
.cpp
| 245
| 7
|
Array44i a = Array44i::Random();
cout << "Here is the array a:" << endl << a << endl;
cout << "Here is a.rightCols<2>():" << endl;
cout << a.rightCols<2>() << endl;
a.rightCols<2>().setZero();
cout << "Now the array a is:" << endl << a << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/BiCGSTAB_step_by_step.cpp
|
.cpp
| 406
| 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);
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_diagonal_int.cpp
|
.cpp
| 270
| 6
|
Matrix4i m = Matrix4i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here are the coefficients on the 1st super-diagonal and 2nd sub-diagonal of m:" << endl
<< m.diagonal(1).transpose() << endl
<< m.diagonal(-2).transpose() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_isInf.cpp
|
.cpp
| 101
| 6
|
Array3d v(1,2,3);
v(1) *= 0.0/0.0;
v(2) /= 0.0;
cout << v << endl << endl;
cout << isinf(v) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Matrix_resize_int_NoChange.cpp
|
.cpp
| 111
| 4
|
MatrixXd m(3,4);
m.resize(5, NoChange);
cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_sin.cpp
|
.cpp
| 58
| 3
|
Array3d v(M_PI, M_PI/2, M_PI/3);
cout << v.sin() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/EigenSolver_eigenvectors.cpp
|
.cpp
| 181
| 5
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Map_inner_stride.cpp
|
.cpp
| 199
| 6
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_min.cpp
|
.cpp
| 54
| 3
|
Array3d v(2,3,4), w(4,2,3);
cout << v.min(w) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_array.cpp
|
.cpp
| 70
| 5
|
Vector3d v(1,2,3);
v.array() += 3;
v.array() -= 2;
cout << v << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_transpose.cpp
|
.cpp
| 414
| 9
|
Matrix2i m = Matrix2i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the transpose of m:" << endl << m.transpose() << endl;
cout << "Here is the coefficient (1,0) in the transpose of m:" << endl
<< m.transpose()(1,0) << endl;
cout << "Let us overwrite this coefficient with the value 0." << endl;
m.transpose()(1,0) = 0;
cout << "Now the matrix m is:" << endl << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_isOrthogonal.cpp
|
.cpp
| 293
| 7
|
Vector3d v(1,0,0);
Vector3d w(1e-4,0,1);
cout << "Here's the vector v:" << endl << v << endl;
cout << "Here's the vector w:" << endl << w << endl;
cout << "v.isOrthogonal(w) returns: " << v.isOrthogonal(w) << endl;
cout << "v.isOrthogonal(w,1e-3) returns: " << v.isOrthogonal(w,1e-3) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/tut_arithmetic_transpose_aliasing.cpp
|
.cpp
| 187
| 5
|
Matrix2i a; a << 1, 2, 3, 4;
cout << "Here is the matrix a:\n" << a << endl;
a = a.transpose(); // !!! do NOT do this !!!
cout << "and the result of the aliasing effect:\n" << a << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_cwiseQuotient.cpp
|
.cpp
| 65
| 3
|
Vector3d v(2,3,4), w(4,2,3);
cout << v.cwiseQuotient(w) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/HouseholderQR_householderQ.cpp
|
.cpp
| 300
| 8
|
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";
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_cwiseNotEqual.cpp
|
.cpp
| 286
| 8
|
MatrixXi m(2,2);
m << 1, 0,
1, 1;
cout << "Comparing m with identity matrix:" << endl;
cout << m.cwiseNotEqual(MatrixXi::Identity(2,2)) << endl;
Index count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count();
cout << "Number of coefficients that are not equal: " << count << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Map_simple.cpp
|
.cpp
| 93
| 4
|
int array[9];
for(int i = 0; i < 9; ++i) array[i] = i;
cout << Map<Matrix3i>(array) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_floor.cpp
|
.cpp
| 93
| 4
|
ArrayXd v = ArrayXd::LinSpaced(7,-2,2);
cout << v << endl << endl;
cout << floor(v) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_setIdentity.cpp
|
.cpp
| 83
| 4
|
Matrix4i m = Matrix4i::Zero();
m.block<3,3>(1,0).setIdentity();
cout << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Jacobi_makeJacobi.cpp
|
.cpp
| 292
| 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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp
|
.cpp
| 132
| 6
|
MatrixXf matA(2, 2);
matA << 1, 2, 3, 4;
MatrixXf matB(4, 4);
matB << matA, matA/10, matA/10, matA;
std::cout << matB << std::endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/tut_arithmetic_transpose_inplace.cpp
|
.cpp
| 173
| 6
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tridiagonalization_diagonal.cpp
|
.cpp
| 552
| 14
|
MatrixXcd X = MatrixXcd::Random(4,4);
MatrixXcd A = X + X.adjoint();
cout << "Here is a random self-adjoint 4x4 matrix:" << endl << A << endl << endl;
Tridiagonalization<MatrixXcd> triOfA(A);
MatrixXd T = triOfA.matrixT();
cout << "The tridiagonal matrix T is:" << endl << T << endl << endl;
cout << "We can also extract the diagonals of T directly ..." << endl;
VectorXd diag = triOfA.diagonal();
cout << "The diagonal is:" << endl << diag << endl;
VectorXd subdiag = triOfA.subDiagonal();
cout << "The subdiagonal is:" << endl << subdiag << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_prod.cpp
|
.cpp
| 171
| 4
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the product of all the coefficients:" << endl << m.prod() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp
|
.cpp
| 271
| 7
|
Matrix4i m = Matrix4i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is m.bottomLeftCorner(2, 2):" << endl;
cout << m.bottomLeftCorner(2, 2) << endl;
m.bottomLeftCorner(2, 2).setZero();
cout << "Now the matrix m is:" << endl << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp
|
.cpp
| 266
| 12
|
RowVectorXd vec1(3);
vec1 << 1, 2, 3;
std::cout << "vec1 = " << vec1 << std::endl;
RowVectorXd vec2(4);
vec2 << 1, 4, 9, 16;
std::cout << "vec2 = " << vec2 << std::endl;
RowVectorXd joined(7);
joined << vec1, vec2;
std::cout << "joined = " << joined << std::endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/FullPivLU_image.cpp
|
.cpp
| 369
| 10
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_boolean_xor.cpp
|
.cpp
| 63
| 3
|
Array3d v(-1,2,1), w(-3,2,3);
cout << ((v<w) ^ (v<0)) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_inverse.cpp
|
.cpp
| 145
| 4
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Its inverse is:" << endl << m.inverse() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/TopicAliasing_mult2.cpp
|
.cpp
| 230
| 11
|
MatrixXf matA(2,2), matB(2,2);
matA << 2, 0, 0, 2;
// Simple but not quite as efficient
matB = matA * matA;
cout << matB << endl << endl;
// More complicated but also more efficient
matB.noalias() = matA * matA;
cout << matB;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/LLT_solve.cpp
|
.cpp
| 456
| 9
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/tut_arithmetic_redux_minmax.cpp
|
.cpp
| 468
| 13
|
Matrix3f m = Matrix3f::Random();
std::ptrdiff_t i, j;
float minOfM = m.minCoeff(&i,&j);
cout << "Here is the matrix m:\n" << m << endl;
cout << "Its minimum coefficient (" << minOfM
<< ") is at position (" << i << "," << j << ")\n\n";
RowVector4i v = RowVector4i::Random();
int maxOfV = v.maxCoeff(&i);
cout << "Here is the vector v: " << v << endl;
cout << "Its maximum coefficient (" << maxOfV
<< ") is at position " << i << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp
|
.cpp
| 193
| 5
|
MatrixXd ones = MatrixXd::Ones(3,3);
SelfAdjointEigenSolver<MatrixXd> es(ones);
cout << "The first eigenvector of the 3x3 matrix of ones is:"
<< endl << es.eigenvectors().col(1) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_row.cpp
|
.cpp
| 82
| 4
|
Matrix3d m = Matrix3d::Identity();
m.row(1) = Vector3d(4,5,6);
cout << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_scalar_power_array.cpp
|
.cpp
| 85
| 3
|
Array<double,1,3> e(2,-3,1./3.);
cout << "10^[" << e << "] = " << pow(10,e) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_isOnes.cpp
|
.cpp
| 216
| 6
|
Matrix3d m = Matrix3d::Ones();
m(0,2) += 1e-4;
cout << "Here's the matrix m:" << endl << m << endl;
cout << "m.isOnes() returns: " << m.isOnes() << endl;
cout << "m.isOnes(1e-3) returns: " << m.isOnes(1e-3) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_hnormalized.cpp
|
.cpp
| 376
| 6
|
Vector4d v = Vector4d::Random();
Projective3d P(Matrix4d::Random());
cout << "v = " << v.transpose() << "]^T" << endl;
cout << "v.hnormalized() = " << v.hnormalized().transpose() << "]^T" << endl;
cout << "P*v = " << (P*v).transpose() << "]^T" << endl;
cout << "(P*v).hnormalized() = " << (P*v).hnormalized().transpose() << "]^T" << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_atan.cpp
|
.cpp
| 65
| 3
|
ArrayXd v = ArrayXd::LinSpaced(5,0,1);
cout << v.atan() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/RealQZ_compute.cpp
|
.cpp
| 819
| 18
|
MatrixXf A = MatrixXf::Random(4,4);
MatrixXf B = MatrixXf::Random(4,4);
RealQZ<MatrixXf> qz(4); // preallocate space for 4x4 matrices
qz.compute(A,B); // A = Q S Z, B = Q T Z
// print original matrices and result of decomposition
cout << "A:\n" << A << "\n" << "B:\n" << B << "\n";
cout << "S:\n" << qz.matrixS() << "\n" << "T:\n" << qz.matrixT() << "\n";
cout << "Q:\n" << qz.matrixQ() << "\n" << "Z:\n" << qz.matrixZ() << "\n";
// verify precision
cout << "\nErrors:"
<< "\n|A-QSZ|: " << (A-qz.matrixQ()*qz.matrixS()*qz.matrixZ()).norm()
<< ", |B-QTZ|: " << (B-qz.matrixQ()*qz.matrixT()*qz.matrixZ()).norm()
<< "\n|QQ* - I|: " << (qz.matrixQ()*qz.matrixQ().adjoint() - MatrixXf::Identity(4,4)).norm()
<< ", |ZZ* - I|: " << (qz.matrixZ()*qz.matrixZ().adjoint() - MatrixXf::Identity(4,4)).norm()
<< "\n";
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_less.cpp
|
.cpp
| 51
| 3
|
Array3d v(1,2,3), w(3,2,1);
cout << (v<w) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_cwiseAbs.cpp
|
.cpp
| 80
| 5
|
MatrixXd m(2,3);
m << 2, -4, 6,
-5, 1, 0;
cout << m.cwiseAbs() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_diagonal.cpp
|
.cpp
| 188
| 5
|
Matrix3i m = Matrix3i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here are the coefficients on the main diagonal of m:" << endl
<< m.diagonal() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/EigenSolver_eigenvalues.cpp
|
.cpp
| 176
| 5
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/ColPivHouseholderQR_solve.cpp
|
.cpp
| 324
| 9
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Matrix_Map_stride.cpp
|
.cpp
| 157
| 8
|
Matrix4i A;
A << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16;
std::cout << Matrix2i::Map(&A(1,1),Stride<8,2>()) << std::endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tutorial_ReshapeMat2Mat.cpp
|
.cpp
| 170
| 6
|
MatrixXf M1(2,6); // Column-major storage
M1 << 1, 2, 3, 4, 5, 6,
7, 8, 9, 10, 11, 12;
Map<MatrixXf> M2(M1.data(), 6,2);
cout << "M2:" << endl << M2 << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_max.cpp
|
.cpp
| 54
| 3
|
Array3d v(2,3,4), w(4,2,3);
cout << v.max(w) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/TopicAliasing_mult1.cpp
|
.cpp
| 76
| 5
|
MatrixXf matA(2,2);
matA << 2, 0, 0, 2;
matA = matA * matA;
cout << matA;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_random_int_int.cpp
|
.cpp
| 39
| 2
|
cout << MatrixXi::Random(2,3) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_triangularView.cpp
|
.cpp
| 573
| 10
|
Matrix3i m = Matrix3i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the upper-triangular matrix extracted from m:" << endl
<< Matrix3i(m.triangularView<Eigen::Upper>()) << endl;
cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl
<< Matrix3i(m.triangularView<Eigen::StrictlyUpper>()) << endl;
cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl
<< Matrix3i(m.triangularView<Eigen::UnitLower>()) << endl;
// FIXME need to implement output for triangularViews (Bug 885)
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_ones.cpp
|
.cpp
| 75
| 3
|
cout << Matrix2d::Ones() << endl;
cout << 6 * RowVector4i::Ones() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_plus.cpp
|
.cpp
| 39
| 3
|
Array3d v(1,2,3);
cout << v+5 << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp
|
.cpp
| 445
| 10
|
MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl;
Tridiagonalization<MatrixXd> triOfA(A);
MatrixXd Q = triOfA.matrixQ();
cout << "The orthogonal matrix Q is:" << endl << Q << endl;
MatrixXd T = triOfA.matrixT();
cout << "The tridiagonal matrix T is:" << endl << T << endl << endl;
cout << "Q * T * Q^T = " << endl << Q * T * Q.transpose() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp
|
.cpp
| 426
| 10
|
MatrixXd X = MatrixXd::Random(4,4);
MatrixXd A = X * X.transpose();
cout << "Here is a random positive-definite matrix, A:" << endl << A << endl << endl;
SelfAdjointEigenSolver<MatrixXd> es(A);
cout << "The inverse square root of A is: " << endl;
cout << es.operatorInverseSqrt() << endl;
cout << "We can also compute it with operatorSqrt() and inverse(). That yields: " << endl;
cout << es.operatorSqrt().inverse() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Matrix_resize_NoChange_int.cpp
|
.cpp
| 111
| 4
|
MatrixXd m(3,4);
m.resize(NoChange, 5);
cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_setZero.cpp
|
.cpp
| 72
| 4
|
Matrix4i m = Matrix4i::Random();
m.row(1).setZero();
cout << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/PartialPivLU_solve.cpp
|
.cpp
| 372
| 8
|
MatrixXd A = MatrixXd::Random(3,3);
MatrixXd B = MatrixXd::Random(3,2);
cout << "Here is the invertible matrix A:" << endl << A << endl;
cout << "Here is the matrix B:" << endl << B << endl;
MatrixXd X = A.lu().solve(B);
cout << "Here is the (unique) solution X to the equation AX=B:" << endl << X << endl;
cout << "Relative error: " << (A*X-B).norm() / B.norm() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/VectorwiseOp_homogeneous.cpp
|
.cpp
| 504
| 7
|
typedef Matrix<double,3,Dynamic> Matrix3Xd;
Matrix3Xd M = Matrix3Xd::Random(3,5);
Projective3d P(Matrix4d::Random());
cout << "The matrix M is:" << endl << M << endl << endl;
cout << "M.colwise().homogeneous():" << endl << M.colwise().homogeneous() << endl << endl;
cout << "P * M.colwise().homogeneous():" << endl << P * M.colwise().homogeneous() << endl << endl;
cout << "P * M.colwise().homogeneous().hnormalized(): " << endl << (P * M.colwise().homogeneous()).colwise().hnormalized() << endl << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Matrix_setOnes_int.cpp
|
.cpp
| 45
| 4
|
VectorXf v;
v.setOnes(3);
cout << v << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp
|
.cpp
| 277
| 7
|
Matrix4i m = Matrix4i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is m.bottomRightCorner<2,2>():" << endl;
cout << m.bottomRightCorner<2,2>() << endl;
m.bottomRightCorner<2,2>().setZero();
cout << "Now the matrix m is:" << endl << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_array_power_array.cpp
|
.cpp
| 232
| 5
|
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
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp
|
.cpp
| 800
| 17
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Matrix_setRandom_int.cpp
|
.cpp
| 47
| 4
|
VectorXf v;
v.setRandom(3);
cout << v << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_boolean_and.cpp
|
.cpp
| 64
| 3
|
Array3d v(-1,2,1), w(-3,2,3);
cout << ((v<w) && (v<0)) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp
|
.cpp
| 262
| 7
|
Matrix4i m = Matrix4i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is m.topLeftCorner(2, 2):" << endl;
cout << m.topLeftCorner(2, 2) << endl;
m.topLeftCorner(2, 2).setZero();
cout << "Now the matrix m is:" << endl << m << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_not_equal.cpp
|
.cpp
| 52
| 3
|
Array3d v(1,2,3), w(3,2,1);
cout << (v!=w) << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/PartialRedux_count.cpp
|
.cpp
| 263
| 6
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
Matrix<ptrdiff_t, 3, 1> res = (m.array() >= 0.5).rowwise().count();
cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl;
cout << res << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/TopicAliasing_cwise.cpp
|
.cpp
| 591
| 21
|
MatrixXf mat(2,2);
mat << 1, 2, 4, 7;
cout << "Here is the matrix mat:\n" << mat << endl << endl;
mat = 2 * mat;
cout << "After 'mat = 2 * mat', mat = \n" << mat << endl << endl;
mat = mat - MatrixXf::Identity(2,2);
cout << "After the subtraction, it becomes\n" << mat << endl << endl;
ArrayXXf arr = mat;
arr = arr.square();
cout << "After squaring, it becomes\n" << arr << endl << endl;
// Combining all operations in one statement:
mat << 1, 2, 4, 7;
mat = (2 * mat - MatrixXf::Identity(2,2)).array().square();
cout << "Doing everything at once yields\n" << mat << endl << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/BiCGSTAB_simple.cpp
|
.cpp
| 393
| 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
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/Cwise_plus_equal.cpp
|
.cpp
| 45
| 4
|
Array3d v(1,2,3);
v += 5;
cout << v << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/LeastSquaresQR.cpp
|
.cpp
| 177
| 5
|
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;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/PartialRedux_sum.cpp
|
.cpp
| 164
| 4
|
Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl;
|
C++
|
2D
|
JaeHyunLee94/mpm2d
|
external/eigen-3.3.9/doc/snippets/tut_matrix_assignment_resizing.cpp
|
.cpp
| 193
| 6
|
MatrixXf a(2,2);
std::cout << "a is of size " << a.rows() << "x" << a.cols() << std::endl;
MatrixXf b(3,3);
a = b;
std::cout << "a is now of size " << a.rows() << "x" << a.cols() << std::endl;
|
C++
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.