sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
8f5c23a94c3eb1783f26431c79796e209265e5f63750a55d2b2438177475e6c3
C++
230
5
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.tail(2):" << endl << v.tail<2>() << endl; v.tail<2>().setZero(); cout << "Now the vector v is:" << endl << v << endl;
9e9076b765dd21b7216978545c1e7a51edabde5eb1b0c5304edf784c6e47685f
C++
230
10
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;
fab079dd8b646a1115af785f8ae94f41f87ad0d4f3eae4ca6d805170b6324c51
C++
231
5
Matrix3d m = Matrix3d::Identity(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isUnitary() returns: " << m.isUnitary() << endl; cout << "m.isUnitary(1e-3) returns: " << m.isUnitary(1e-3) << endl;
4d5afff26cf5c6f0e6ee5be2d225074a048485df6176c91f0246c50469bb0826
C++
233
6
Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.topRows(2):" << endl; cout << a.topRows(2) << endl; a.topRows(2).setZero(); cout << "Now the array a is:" << endl << a << endl;
787a831e115640ed345c552c3de3010637fed0eaf43cffc719e5721d959a7365
C++
233
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block<Matrix3d,3,3> b(m,0,0); } int main() {}
88ba40112fac30bf5f12c33a56815f67e8c4bc504510123e912c1937b844850b
C++
233
9
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include "AppConfig.h" #include <juce_cryptography/juce_cryptography.cpp>
8bbd77ce324d4958c0d899727d97a4c8eb4f426d0fa1d7ced1314aa56b4ca7e4
C++
233
9
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include "AppConfig.h" #include <juce_audio_basics/juce_audio_basics.cpp>
b602458e645d93ce753db731a7ab6f301d9b0fa7e666f38c1792a21d83a1d087
C++
233
5
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.start(2):" << endl << v.start<2>() << endl; v.start<2>().setZero(); cout << "Now the vector v is:" << endl << v << endl;
f8ac7c7a3ca9e9c168d3c43f44b516fa93cf53b780186ecf49d985873903b03d
C++
233
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block<Matrix3d> b(m,0,0,3,3); } int main() {}
fc9f88071f4bba35dad732e77a7ab8409db494136ddcec47a994ba6b12fe9471
C++
234
4
Vector3d v(-1,2,-3); cout << "the absolute values:" << endl << v.array().abs() << endl; cout << "the absolute values plus one:" << endl << v.array().abs()+1 << endl; cout << "sum of the squares: " << v.array().square().sum() << endl;
1075fe880ba54b08264c703215cb4a2a67107dee37b65fceab21e303ff47cfb4
C++
235
9
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include "AppConfig.h" #include <juce_audio_devices/juce_audio_devices.cpp>
3ed741e1953ef293aaea98e222badc239bd04f47d8c799121452b679b0ff6c99
C++
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;
859ef23aee7f92249e41a1a29ecc4fb2c1d94fa1fb4f686e78578b5c054e5fba
C++
235
5
Matrix3d m = Matrix3d::Identity(); m(0,2) = 1e-4; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isIdentity() returns: " << m.isIdentity() << endl; cout << "m.isIdentity(1e-3) returns: " << m.isIdentity(1e-3) << endl;
9f21690250ce9151bd50533b60e8b2d4435a58ccd7fb5db3ab1cf87b614baad7
C++
235
6
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;
fac08fa9d5b608db37e4288d057f292d33f6ee1f9b078e5b9f0beb8da98f13ec
C++
235
9
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include "AppConfig.h" #include <juce_audio_formats/juce_audio_formats.cpp>
d98af55482265f8dedb086e0b4f5e88c0ec3e588573c3ecdc369e1c91e80dc5d
C++
236
6
Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.leftCols(2):" << endl; cout << a.leftCols(2) << endl; a.leftCols(2).setZero(); cout << "Now the array a is:" << endl << a << endl;
5992080c92243c36c666843b4c3b79d1e213b0d9a1acd7e30e21e58817f2da10
C++
237
16
#include <Eigen/Dense> #include <iostream> using namespace Eigen; using namespace std; int main() { ArrayXXf a(2,2); ArrayXXf b(2,2); a << 1,2, 3,4; b << 5,6, 7,8; cout << "a * b = " << endl << a * b << endl; }
fa3db3490b12f7fc650b485fe6ffe66aaff926187b82f4f865fa6585e968c97b
C++
237
12
#include "vbfa.h" #include "peerutil.h" using namespace PEER; int main (int argc, char * const argv[]) { sPeerArgs args = parseCmdlineArgs(argc, argv); cPEER vb = getInstance(args); vb.update(); write_output(vb, args); return 0; }
189b376b2c68e07774df26d6f00b61f27bcb5c23e47a615e6c3bd8125fbf6057
C++
239
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Diagonal<Matrix3d> b(m.diagonal()); } int main() {}
71ced84b117ed672adaee4bf2b1bf945f0299d419e145c1470dd06848847fd5b
C++
239
6
Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.topRows<2>():" << endl; cout << a.topRows<2>() << endl; a.topRows<2>().setZero(); cout << "Now the array a is:" << endl << a << endl;
a74f67580eef887e67efb4f41e90a8a90d0d518b45b28244894ab51037a87b53
C++
239
6
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;
b1f647c20e6be95dc62bd3dd16c3dcc46f17e11ef2101cf1ff550d225b344000
C++
239
9
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include "AppConfig.h" #include <juce_data_structures/juce_data_structures.cpp>
4f953969fe25b6bfdf89642726b44d270c07e1ec929611b2cbdd1de21f7cad28
C++
240
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block<Matrix3d> b(m.block(0,0,3,3)); } int main() {}
692bd6b37aa9330200c4bfafd09a915f5ba35cd2ecf1bac288b27728de8be6f9
C++
241
9
/* IMPORTANT! This file is auto-generated each time you save your project - if you alter its contents, your changes may be overwritten! */ #include "AppConfig.h" #include <juce_audio_processors/juce_audio_processors.cpp>
834053019659b5b7298375b9480200f748ea01fce6e7b3dc9e648e8ecbd24093
C++
241
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Transpose<Matrix3d> b(m.transpose()); } int main() {}
98adcd7814b309f56613872c64feb97dd05505403b9aa9dbd3ac27db9ed817e6
C++
241
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(float *ptr){ Map<CV_QUALIFIER Vector3f>(ptr).coeffRef(0) = 1.0f; } int main() {}
fec75da827000f310573adeaa1a541dd7a010f02a58321adfea057e52785b899
C++
241
6
Matrix3d m = 10000 * Matrix3d::Identity(); m(0,2) = 1; cout << "Here's the matrix m:" << endl << m << endl; cout << "m.isDiagonal() returns: " << m.isDiagonal() << endl; cout << "m.isDiagonal(1e-3) returns: " << m.isDiagonal(1e-3) << endl;
4f2dad3871c0ef97887ed13ddff2f10902c15205a49d185d2d819e534428618e
C++
242
6
Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.leftCols<2>():" << endl; cout << a.leftCols<2>() << endl; a.leftCols<2>().setZero(); cout << "Now the array a is:" << endl << a << endl;
7dcb997e1df9ed59764ab80bf817e5bd79e6dcc6d731a8e5422b67db0fe3a654
C++
242
4
Vector3d v(-1,2,-3); cout << "the absolute values:" << endl << v.cwise().abs() << endl; cout << "the absolute values plus one:" << endl << v.cwise().abs().cwise()+1 << endl; cout << "sum of the squares: " << v.cwise().square().sum() << endl;
aefa59d9e0ca0a10f2f1026a8be8900063e6c9f8005312c50756952fa6f029d3
C++
242
6
Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.bottomRows(2):" << endl; cout << a.bottomRows(2) << endl; a.bottomRows(2).setZero(); cout << "Now the array a is:" << endl << a << endl;
5b89d0ff6671fc1fd5b89e51e5fdf1019c6284c7363822ef0454f93bb5d74d84
C++
244
5
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.block<2,2>(1,1):" << endl << m.block<2,2>(1,1) << endl; m.block<2,2>(1,1).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
5f218ff116cc2e3ea4594f0bc0ed7452c2b421e317ce82c9c3ae9566872b3e8a
C++
244
5
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.segment(1, 2):" << endl << v.segment(1, 2) << endl; v.segment(1, 2).setZero(); cout << "Now the vector v is:" << endl << v << endl;
6d3b5589218cd2b196df1aa0264baa561ab11236d7854394f396ecadb3d8c028
C++
244
5
RowVector4i v = RowVector4i::Random(); cout << "Here is the vector v:" << endl << v << endl; cout << "Here is v.segment<2>(1):" << endl << v.segment<2>(1) << endl; v.segment<2>(2).setZero(); cout << "Now the vector v is:" << endl << v << endl;
af8c299aefe68de46ceb36049de783d72239f275d6359f186f9355290577fcf1
C++
244
13
#include <iostream> #include <Eigen/Dense> using namespace std; int main() { Eigen::MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Row's maximum: " << std::endl << mat.rowwise().maxCoeff() << std::endl; }
084e1db7cf56aaaac37d67efeeeff6521f5e772574c2ead3b649873f793c916a
C++
245
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ Block<Matrix3d,3,3> b(m.block<3,3>(0,0)); } int main() {}
6b151ae64a34dd9c2f932b5fd16f4dd0c214414dc742169226a894bb83d6fb10
C++
245
6
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;
797e8421b58a73e1e24db3c3c2591e77b6ac305b9178d35e408b6cbe85452998
C++
245
16
/** * @file orderings.cc * * Implement the BGL matrix orderings wrappers. */ /* * David Gleich * 21 April 2006 */ #include "include/matlab_bgl.h" #include <yasmic/simple_csr_matrix_as_graph.hpp> #include <yasmic/iterator_utility.hpp>
a42e30585a931a54454137bca2e3fe5822eb5a5fa449fbf8b2044c721eaf3bf5
C++
246
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr, DenseIndex size){ Map<ArrayXf> m(ptr, size); } int main() {}
78c3c7be3798985015e320b8b1ec595bec9af55c624d958e408bdaa28139054a
C++
247
13
#include <iostream> #include <Eigen/Dense> using namespace std; int main() { Eigen::MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; std::cout << "Column's maximum: " << std::endl << mat.colwise().maxCoeff() << std::endl; }
5030c4262d3e20a3569d5c6f25b97e5492682ef52ac9a4b2022ee95af6b15b9a
C++
248
6
Array44i a = Array44i::Random(); cout << "Here is the array a:" << endl << a << endl; cout << "Here is a.bottomRows<2>():" << endl; cout << a.bottomRows<2>() << endl; a.bottomRows<2>().setZero(); cout << "Now the array a is:" << endl << a << endl;
e4bdd5d1150d85fe28c88c13b023b62929bdef65fadc0ecacf83e45f2502a027
C++
249
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(float *ptr){ Map<CV_QUALIFIER MatrixXf>(ptr, 1, 1).coeffRef(0,0) = 1.0f; } int main() {}
598972da7ca8fb747bfe4a95baa96957628db1466cbab176e85f97bcb227ba1d
C++
250
5
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.block(1, 1, 2, 2):" << endl << m.block(1, 1, 2, 2) << endl; m.block(1, 1, 2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
8b6dcf7532c50ae26b50c13b3e26177bfbe4f6da632d9dc5236e05e1c10a68c9
C++
250
16
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; Diagonal<CV_QUALIFIER MatrixXf>(m).coeffRef(0) = 1.0f; } int main() {}
a2f56e70b43a0b9bb96fa0c196c4ef8a7004ca11a939c57be24c3649fa39c460
C++
254
16
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; Transpose<CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f; } int main() {}
0bca2332bb89fdfd67c8456294b48a888d8e6348721ae0bdd5777cac14efc57a
C++
256
9
Matrix3f A; Vector3f b; A << 1,2,3, 4,5,6, 7,8,9; b << 3, 3, 4; cout << "Here is the matrix A:" << endl << A << endl; cout << "Here is the vector b:" << endl << b << endl; Vector3f x; x = A.lu().solve(b); cout << "The solution is:" << endl << x << endl;
1d45b422a63ad0e71516c6c96710f0159cf38f13da5d57e0eaafea53b06f01b8
C++
261
16
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER Matrix3d &m){ // row/column constructor Block<Matrix3d,3,1> b(m,0); } int main() {}
1e3c13e7778998ec2ad3f3b71b812b8eb2f7ddafed20aa26d0d7f433523259ed
C++
262
16
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ MatrixXf m; Block<CV_QUALIFIER MatrixXf, 3, 3>(m, 0, 0).coeffRef(0, 0) = 1.0f; } int main() {}
b75858ed52d328dae0e5d29dcf258d42c226b61bc62c50bb344a90c40ea99884
C++
262
16
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(){ Matrix3f m; Block<CV_QUALIFIER Matrix3f>(m, 0, 0, 3, 3).coeffRef(0, 0) = 1.0f; } int main() {}
cf56ad73a41971355b8d8f84abbfac3952edde86598eb8a497493f91b01b52b7
C++
262
6
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;
dbf3a74b532165aeb97b4e06199f51eb191e98ae94ebdc26245226358133a2c4
C++
263
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;
4122a526aabc84b9ab92c5a1d25c7c3bbcd1cf137e73ad95f76103b796dd381f
C++
265
6
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;
a98b849784202550776d7c3fca13203438a620af0773ae6d48d357c258dbfad7
C++
265
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topRightCorner(2, 2):" << endl; cout << m.topRightCorner(2, 2) << endl; m.topRightCorner(2, 2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
1eba36e9b632646b827a1ccc6a2f1938d100dc7dfddca31d528e8f381473c307
C++
267
11
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;
4fa7dabe5fe73b6ac48228b9f7af51d6309bdc70a477266dbc8180fb3bb49419
C++
267
7
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;
511ae82f79e884cec4e9cd60f481d3b9e92089bd2106b0a5f2e6f999f862db6f
C++
268
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topRightCorner<2,2>():" << endl; cout << m.topRightCorner<2,2>() << endl; m.topRightCorner<2,2>().setZero(); cout << "Now the matrix m is:" << endl << m << endl;
ee53d2d07c9c98c601c1ec415f2ebe1e87ce2e750587bddfeed17e40221f831e
C++
268
11
// Copyright 2019 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt #include <boost/assert.hpp> int main() { int x = 5; BOOST_ASSERT( x > 4 ); }
1a970b86297caa6974b8141a7d7354558d9a71ce9f30a641500cd46f77d41548
C++
270
7
MatrixXi mat(3,3); mat << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << "Here is the matrix mat:\n" << mat << endl; // The eval() solves the aliasing problem mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2).eval(); cout << "After the assignment, mat = \n" << mat << endl;
1bee861b8f27dbb3a4af64ded9e2a6403b36f383849e17aa3c22aedfd4ab3205
C++
270
5
Matrix2d m; m << 1,2,3,4; cout << (m*m).lazy().row(0) << endl; // this computes only one row of the product. By contrast, // if we did "(m*m).row(0);" then m*m would first be evaluated into // a temporary, because the Product expression has the EvalBeforeNestingBit.
88f4c0e617e0dad1841fb99a8a260ef562e7f8c859870b35389d9ee14e897da2
C++
270
5
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;
af737a55ec7b81f7d9d543f2a42bea6b554460b5d087a58447a8704d671b6c48
C++
270
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr, DenseIndex rows, DenseIndex cols){ Map<MatrixXf> m(ptr, rows, cols); } int main() {}
f14e157500eda7d96f6b4eeb4addfd15ffefaea6ee8244b8ff3b3625b801edd8
C++
271
6
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;
9a4847ad566a826762f01cc661845ad184e15e6cec503edc46f9815676df26f5
C++
272
7
ArrayXXf table(10, 4); table.col(0) = ArrayXf::LinSpaced(10, 0, 90); table.col(1) = M_PI / 180 * table.col(0); table.col(2) = table.col(1).sin(); table.col(3) = table.col(1).cos(); std::cout << " Degrees Radians Sine Cosine\n"; std::cout << table << std::endl;
c853a6dff35cadbf7f9791868d982de185a670e3091e6577a3dfb92feb861ac4
C++
273
8
Matrix3f A; Vector3f b; A << 1,2,3, 0,5,6, 0,0,10; b << 3, 3, 4; cout << "Here is the matrix A:" << endl << A << endl; cout << "Here is the vector b:" << endl << b << endl; Vector3f x = A.triangularView<Upper>().solve(b); cout << "The solution is:" << endl << x << endl;
0e03b83e02f689768a5d948a0f48f4f45724b0eb37301b53129105a1564d4224
C++
274
7
MatrixXi m(2,2); m << 1, 0, 1, 1; cout << "Comparing m with identity matrix:" << endl; cout << m.cwiseEqual(MatrixXi::Identity(2,2)) << endl; int count = m.cwiseEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are equal: " << count << endl;
36e3c655ae2822db5f8b4fda32e8679265aa9493d8f7bc88a88f78c489d20611
C++
274
6
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;
79742762639d117cd1f78393a469c567253a60fa507c39f791576ed54ca48b52
C++
274
5
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;
a8746e17afaea4cabad50d0709633ec27250e445fdc648c2feb74e6646512701
C++
274
6
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;
f0873f6c19de7f3a82cf261108b06ac7b0823bbf86c4f334d83e6b14fb5da345
C++
274
5
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;
4f3c0ff3776c62a5f29e18c456435a2fbe0353f6c0a59101bcef00adbf11e54b
C++
277
6
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;
5faac48937a0a8f254dc0cafd57d8ceb321d8f3a49b317bc30ded17253bb2e6b
C++
277
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;
a6206d5c4d24b1cc9a51016da230d52c8136ffa1ecf956feb783ef568b0603e0
C++
278
11
// Copyright 2016 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // See http://www.boost.org/libs/chrono for documentation. #include <boost/chrono/chrono.hpp> int main() { return 0; }
8cbb77af770b358940fbfeddefdfc03432924b712cdbed1a06328b2ac7482965
C++
281
5
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;
5afd76c9bc59ae46edc9ea370b77b737daf09545c80dd91703cac55b7494bf68
C++
282
15
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl; return 0; }
64810dae234488eaaab2a34660ab8e49d308ad03c2d53d9bd3713c37726008f2
C++
282
15
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(2..3,:) =\n" << A.middleRows(2,2) << endl; return 0; }
c8223386cfb5adeb43bcc0ac8284939bc937413750def479738ab80f4e2c0fbe
C++
282
15
#include <Eigen/Core> #include <iostream> using namespace Eigen; int main() { Matrix3f m3; m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; Matrix4f m4 = Matrix4f::Identity(); Vector4i v4(1, 2, 3, 4); std::cout << "m3\n" << m3 << "\nm4:\n" << m4 << "\nv4:\n" << v4 << std::endl; }
23a0238fb2f92da9aad5efdbf7c30bfe94fcc5cdafaa54487ddafc1ba462e9bd
C++
283
15
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl; return 0; }
82cef3aa206674d8df2c5ec59f2575fe853adb5367ae5b07214e8f880ad299a2
C++
283
15
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main(void) { int const N = 5; MatrixXi A(N,N); A.setRandom(); cout << "A =\n" << A << '\n' << endl; cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl; return 0; }
971b7118fd6d4bb8876e26a086030d9447aae166c9559cc4b1598034aa03dffc
C++
284
7
MatrixXi m(2,2); m << 1, 0, 1, 1; cout << "Comparing m with identity matrix:" << endl; cout << m.cwiseNotEqual(MatrixXi::Identity(2,2)) << endl; int count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are not equal: " << count << endl;
b830436e7064e16d5e88f46eaed2d20bdb3658b63df52b8ccf89621ee3814967
C++
284
5
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.cwise().abs().rowwise().maxCoeff() << endl;
c0863cbd26dd397131db9e0ccdf1062d14d3df1824fd2141806a1f12a633fa14
C++
287
5
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl; cout << "Here is the maximum absolute value of each column:" << endl << m.cwiseAbs().colwise().maxCoeff() << endl;
ab8e7d2a6ec16b6f0b3e0b4db76dc44030f626622f743a9c4c8ec427ab37a6f8
C++
289
15
#include <iostream> #include <Eigen/Dense> using namespace Eigen; using namespace std; int main() { Matrix3f m = Matrix3f::Random(); m = (m + Matrix3f::Constant(1.2)) * 50; cout << "m =" << endl << m << endl; Vector3f v(1,2,3); cout << "m * v =" << endl << m * v << endl; }
6015fdc752a1b8ae7cd7cbe275ad72d2732533850cfe48d749b6c152d289893d
C++
290
13
Matrix3i m1; m1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; cout << m1 << endl << endl; Matrix3i m2 = Matrix3i::Identity(); m2.block(0,0, 2,2) << 10, 11, 12, 13; cout << m2 << endl << endl; Vector2i v1; v1 << 14, 15; m2 << v1.transpose(), 16, v1, m1.block(1,1,2,2); cout << m2 << endl;
7003ef536c805ff07cd0f3c5eb09a8338e7f4c4afc872e57df744cee799db2fc
C++
290
5
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl; cout << "Here is the maximum absolute value of each column:" << endl << m.cwise().abs().colwise().maxCoeff() << endl;
43d4d0ef87a46bcc942e67afaba7de26545ee74195af50b07b5d7019e920ffbf
C++
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;
fd3a21e6ccb765fa16806960ba1677339e434dd70a3faf21a0a260f5470148ef
C++
293
6
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;
bd320161de0d390fdf8fb6c238d8ab1465f246d2eb5ae2c08bd101aec84988ad
C++
296
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the bottom-right 2x3 corner in m:" << endl << m.corner<2,3>(Eigen::BottomRight) << endl; m.corner<2,3>(Eigen::BottomRight).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
c46bf40771b8d9d82199ae483b9c88d018d1ad02d42eee79236bf47590157d46
C++
298
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the bottom-right 2x3 corner in m:" << endl << m.corner(Eigen::BottomRight, 2, 3) << endl; m.corner(Eigen::BottomRight, 2, 3).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
cf52d0bfd22fc759fec2dcf3636832c562df08018903879044a48d4b6115aa81
C++
301
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;
cfb5e013c7bb1c4832fb736c854ed640ad9fe343ef11f93c5ff6fe66f5daa9d5
C++
303
6
Matrix4d X = Matrix4d::Random(4,4); Matrix4d A = X + X.transpose(); cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl; Tridiagonalization<Matrix4d> triOfA(A); Vector3d hc = triOfA.householderCoefficients(); cout << "The vector of Householder coefficients is:" << endl << hc << endl;
159bba1b51ebafcf304bf970aca0e95a1bd61e8a513f17fb140bf2533ae549f4
C++
305
15
#include <iostream> #include <Eigen/Dense> using namespace Eigen; using namespace std; int main() { MatrixXf m = MatrixXf::Random(3,3); m = (m + MatrixXf::Constant(3,3,1.2)) * 50; cout << "m =" << endl << m << endl; VectorXf v(3); v << 1, 2, 3; cout << "m * v =" << endl << m * v << endl; }
3692cff2dbb1fa4fc750be9ab5dd86bc4284e353e85a4f41a202252a984afb9e
C++
307
17
#include <Eigen/Core> USING_PART_OF_NAMESPACE_EIGEN using namespace std; int main() { typedef Matrix<SCALAR,Eigen::Dynamic,1> Vec; Vec v(SIZE); v.setZero(); v[0] = 1; v[1] = 2; for(int i = 0; i < 1000000; i++) { v.coeffRef(0) += v.sum() * SCALAR(1e-20); } cout << v.sum() << endl; }
ecc28a1f2b33c76649adbb06924591def309ba6502108af74d3640afe85cf25b
C++
310
7
MatrixXf m = MatrixXf::Random(3,5); cout << "Here is the matrix m:" << endl << m << endl; MatrixXf ker = m.lu().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;
1128fb08008798f840336e2798f22255d18bda291c6b8717cf7b003ae00ad05f
C++
314
15
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void foo(CV_QUALIFIER float *ptr, DenseIndex rows, DenseIndex cols){ Map<MatrixXf, Aligned, InnerStride<2> > m(ptr, rows, cols, InnerStride<2>()); } int main() {}
e8bfedafec9ba8d6e97b18d6c3e81b0d6d6fa37a4e989b60e218ebfddc90c1c4
C++
315
6
// This puts most asio functions in this object file instead of everywhere // it is called when compiled with BOOST_ASIO_SEPARATE_COMPILATION in lslboost // Normally, one would just compile boost/asio/impl/src.hpp but some compilers // think they should generate a precompiled header. #include <asio/impl/src.hpp>
6a21606f2140bfc894a9c5d73eeb0e5a3badfff6478ea0e0611b91462963855e
C++
317
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;
c30a2674abf404bc1554021324182aadda82dfd4739adf1fca29bf0715bc257c
C++
317
15
#include <Eigen/Core> // import most common Eigen types USING_PART_OF_NAMESPACE_EIGEN int main(int, char *[]) { Matrix3f m3; m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9; Matrix4f m4 = Matrix4f::Identity(); Vector4i v4(1, 2, 3, 4); std::cout << "m3\n" << m3 << "\nm4:\n" << m4 << "\nv4:\n" << v4 << std::endl; }
4809e62c34222339c09e19077430d0d7a18d12365c78ee02c150c773f15a0ff0
C++
318
11
Matrix3d m = Matrix3d::Random(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d inverse; bool invertible; m.computeInverseWithCheck(inverse,invertible); if(invertible) { cout << "It is invertible, and its inverse is:" << endl << inverse << endl; } else { cout << "It is not invertible." << endl; }
850207bdc9ffd44ee8e2dc3af98e5b05a87791196567c07e0578e54b38f58d8d
C++
318
10
Matrix3f A(3,3); A << 1,2,3, 4,5,6, 7,8,10; Matrix<float,3,2> B; B << 3,1, 3,1, 4,1; Matrix<float,3,2> X; X = A.fullPivLu().solve(B); cout << "The solution with right-hand side (3,3,4) is:" << endl; cout << X.col(0) << endl; cout << "The solution with right-hand side (1,1,1) is:" << endl; cout << X.col(1) << endl;
4eb5ead226ed96f7948e86aaeb8598fa16f251d4610896c650a72127f0d1c9bc
C++
319
11
// // logger_service.cpp // ~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include "logger_service.hpp"
63980d42a7cd12839ddbf12542549c701c7e367f489b6c9d68814ccda1f16edd
C++
320
18
#include <iostream> #include <Eigen/Core> using namespace Eigen; using namespace std; int main() { typedef Matrix<SCALAR,Eigen::Dynamic,1> Vec; Vec v(SIZE); v.setZero(); v[0] = 1; v[1] = 2; for(int i = 0; i < 1000000; i++) { v.coeffRef(0) += v.sum() * SCALAR(1e-20); } cout << v.sum() << endl; }