sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
4eaf3f6c7cc192284cbaa19ff15560346948ed529cca8f27d7841273c428fc4e
C++
257
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; }
4321d80a03630a3981873ecdf56f1be0f673a8c77d6188edd5f5ddb97597f56e
C++
259
16
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // create a JSON array json j_array = {0, 1, 2, 3, 4, 5}; // call erase() j_array.erase(2); // print values std::cout << j_array << '\n'; }
ba50938d5650ccac1a88c78f6bd663673eb318d065dac147b62e5324c8267924
C++
259
14
#include "../Eigen/SVD" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { BDCSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
0585323842dcd0f9b5c7c0fbec8a074cc0f291e683ded09ad9de81de0fae9c83
C++
260
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; }
fd5a9991b62047fc5692fc6b37be5a6907e27c0fc7b30e8170b358312b980613
C++
260
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() {}
5b886ca91aca23ee834ade4fd57bc543580e85e12f2182edb9103af24b376d30
C++
261
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() {}
9849989c5f94bd9db6407e638056b784bad38d775df53f99d1b49260f4c674a9
C++
261
14
#include "../Eigen/LU" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { FullPivLU<Matrix<SCALAR,Dynamic,Dynamic> > lu(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
58584ddf5eac3d862c3b5b4e3117f4cc8b201066b61cd7e8192f3f26b85ab1c5
C++
262
14
#include "../Eigen/SVD" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
f4635e368dd2989c4482d35faadabec66f489aa9b0235f94f1aaf70da969167b
C++
262
14
#include "../Eigen/Cholesky" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { LLT<Matrix<SCALAR,Dynamic,Dynamic> > llt(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
1a23121b57cf1107979c6cab4b13759f3acf4f84c8f8d624a84ca008b9d0dafe
C++
264
14
#include "../Eigen/LU" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { PartialPivLU<Matrix<SCALAR,Dynamic,Dynamic> > lu(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
3f3156e8c1b00ad826b29b2eab92cd065731bb1a735d8f71018e62ac4c3fe6a2
C++
264
14
#include "../Eigen/Cholesky" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { LDLT<Matrix<SCALAR,Dynamic,Dynamic> > ldlt(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
89e347c975e4636c11aa4662f0b44566119acaadf8a349dd30281947e19ac6d8
C++
264
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() {}
7f3982490f762db542871e54b0ac4f01621ba2a14d910fcfbda606a821576bac
C++
265
10
#include <iostream> #include <iomanip> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { std::cout << std::boolalpha << std::is_same<nlohmann::byte_container_with_subtype<std::vector<std::uint8_t>>, json::binary_t>::value << std::endl; }
b67c0289400e3c34a45d444febd60d1fa56c33efe2edc1cfb84802c0fa2ed25b
C++
265
14
#include "../Eigen/QR" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
d330f805e816e707338bf0af3aa1a8163483d796eca0ac3708338bbb9d2052b0
C++
265
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;
82fcf069676e1b716059261193f48a478a727399994455e0c8e4c61ed2dbf561
C++
266
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() {}
cbe323cf272e75d283c31b15ce14f504f351c373313e2b205d26ca634fbbb246
C++
266
11
#include <iostream> #include <arbor/spike_event.hpp> namespace arb { ARB_ARBOR_API std::ostream& operator<<(std::ostream& o, const spike_event& ev) { return o << "E[tgt " << ev.target << ", t " << ev.time << ", w " << ev.weight << "]"; } } // namespace arb
2a4d2d15b3d0f1f90d4f63a77f5f81d95ddacd98c4e9e6a3e83e5816cda6484f
C++
267
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;
076efe9c6746c47f63437ca92f3a682271cd124984e004cdf99669cbaa1d5e5e
C++
268
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;
94b0b128b6b6044f451fd52d1d2a6a96e076662c1e20485334756d1533578f7e
C++
268
13
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // create JSON array const json array = {"first", "2nd", "third", "fourth"}; // output element at index 2 (third element) std::cout << array.at(2) << '\n'; }
a3081600cc91dd05399a7c5482598fc1f2c2038d4fef30e6a5c5bf5d62697978
C++
268
5
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;
4b54ca35c86db8d24e68e6eb80860ff3aa9b9b06f5b71ada7a35ac3c94f39544
C++
269
5
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the block:" << endl << m.block<2, Dynamic>(1, 1, 2, 3) << endl; m.block<2, Dynamic>(1, 1, 2, 3).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
709060bd04d45d4d1955a132ce63f7684d65941d17edd40b8729010a7c662a4b
C++
270
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() {}
220831185fa1c5ddd7d4b15691dc03775ba3a19a23afcf2bc922d53416a407f6
C++
271
14
#include "../Eigen/QR" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { ColPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
8bfad596e7b0d82eead3b9cac861cdd518ddb4a8fb1bc9ac7ed356a489f0e5a1
C++
271
15
// Cytosim was created by Francois Nedelec. Copyright 2007-2017 EMBL. #include "line_disp.h" void LineDisp::clear() { visible = 1; color = 0xFFFFFFFF; explode_shift = 0; end_color[0] = 0xFFFFFFFF; end_color[1] = 0xFFFFFFFF; }
985fb136ed3f9c1e98fa8ef81f29d900e3e9b92589edca7fb45bac152a5535b5
C++
271
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;
f530b6749065453931c2cf802193d84ecf5e828f8e5e46072002b1c5792b0049
C++
271
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;
e11b18c4c7e006f2807ee7249ffe9d3b368b6e12a22a2bb5e9708f46ec7e447f
C++
272
14
#include "../Eigen/QR" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { FullPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
7815a02d05eb4bf9c46d34db13071de8644c295d62656fcd565adc17ad7dc503
C++
273
14
#include "../Eigen/Eigenvalues" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR int #else #define SCALAR float #endif using namespace Eigen; int main() { EigenSolver<Matrix<SCALAR,Dynamic,Dynamic> > eig(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
0883fbbbc1288b942c505ddcea7dd31c87a90d7b316632a489c1edcd79ec5307
C++
274
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;
d454cd45c41e009ad53cb40216115c5d1c807d01c853bf3c7efc80557ec85945
C++
274
14
#include <glm/gtx/exterior_product.hpp> #include <glm/gtc/epsilon.hpp> #include <glm/vec2.hpp> int main() { int Error = 0; float const f = glm::cross(glm::vec2(1.0f, 1.0f), glm::vec2(1.0f, 1.0f)); Error += glm::epsilonEqual(f, 0.0f, 0.001f) ? 0 : 1; return Error; }
d738181028a513834539d96c8ffe89ba3760a4fc50a80d242c9e82b0affef66f
C++
274
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;
3577d3380105534489e098d8db429cd140b8e34889a0c5546472a56566d7859d
C++
275
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;
0ffdff82f7ddc1404b13ea1aac877cb6eb92a9fdaff4df8b41a2517358916837
C++
277
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() {}
2a7b736eaf37e8712de26d4e1918eb93d0501f8e8f33bd49cdcfe88dcefed416
C++
277
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;
3ab22be686c1b43ffe3949a87a0d9b9d5f725081f80bc07926c025c56998acfd
C++
277
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;
a0ac78d76c7c56c1ab33415b760cf3678494c0473efa9682d2df79c7403e7089
C++
277
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;
bf7e4c26f521888ff046794a78f80919a18930df74dc24417e08009bd774b285
C++
277
20
#define GLM_ENABLE_EXPERIMENTAL #include <glm/gtx/color_space.hpp> int test_saturation() { int Error(0); glm::vec4 Color = glm::saturation(1.0f, glm::vec4(1.0, 0.5, 0.0, 1.0)); return Error; } int main() { int Error(0); Error += test_saturation(); return Error; }
0f06a083591af51a2bbe15bd2eae3077bd2ba96691ca43ddef545ce9bb5a1617
C++
278
6
// This file is autogenerated. Changes will be overwritten. #include "2LCCYRVYXB/moc_ScatterDataModifier.cpp" #include "2LCCYRVYXB/moc_mainwindow.cpp" #include "2LCCYRVYXB/moc_openglwindow.cpp" #include "HFA4SCIXVZ/moc_qcustomplot.cpp" #include "2LCCYRVYXB/moc_slidergroup.cpp"
6a8a527f09d66a07f75c3a2d1706fbea7a7816f85d9bd7ea1b6ede1ff1a1fb0e
C++
278
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() {}
c2f401c296a4ab796cdf5dedc0cf0466b85cc5d7c65988c8ceebd83471126ba6
C++
278
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() {}
0352b1741862d2e027fa7f3f10f82ec607d98a7fd2544c1010c325638a3c2686
C++
279
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;
273a0b992e86d3ae2aa78fbf3be1109b76878183cce6353a2fc5394cb08b2b28
C++
279
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;
5483fd4f2407319c33dd00858453a1ae83dd8dae8b944c3d90e12b92415ffdec
C++
279
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;
3c093e91384f416ee762d7933144ac2df544c6c3e85a205ab2c31970319e273d
C++
280
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;
9eef836e1760d83a65d268c2871f9b8726b4369fec0941444afadfdfaf6b973d
C++
280
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;
45c973f7af982e3a9949758e17109346393eeffe0e811be59655b09efa22f911
C++
281
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; TriangularView<CV_QUALIFIER MatrixXf,Upper>(m).coeffRef(0, 0) = 1.0f; } int main() {}
cc65ebba2801c0f246fb9d9f73e84e5e04d120444c0e3440259c490cb419e4e4
C++
281
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;
f5112014d3eb41d83f8eee4fcd7500981c491a6839af1c3766324856e58af974
C++
281
18
#include "../Eigen/Core" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define CV_QUALIFIER const #else #define CV_QUALIFIER #endif using namespace Eigen; void call_ref(Ref<VectorXf> a) { } int main() { VectorXf a(10); CV_QUALIFIER VectorXf& ac(a); call_ref(ac); }
ea02649fd78d6cf8fdca3f31fcc2dcafc7558fa8a439f8966de3393c9c761b3b
C++
282
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; SelfAdjointView<CV_QUALIFIER MatrixXf,Upper>(m).coeffRef(0, 0) = 1.0f; } int main() {}
0a79e9deb1d2d19e17568b7cf0a96adda5d2ef8d57e5b648c569c6bf28aab607
C++
283
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;
9f5abf42324b987b950cdae717c9e726cbcc35bfa01d59c12a5b4b08fd8c903c
C++
283
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; Index count = m.cwiseEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are equal: " << count << endl;
f5e2893dad76af7e363954765461808f6adea67c337c0b6b2fc3709bfd126981
C++
283
18
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // create JSON values json a = 23; json b = 42; // copy-assign a to b b = a; // serialize the JSON arrays std::cout << a << '\n'; std::cout << b << '\n'; }
6659068e79d60214231ee68d589866f6d19f97f17397717849611336b6acf38a
C++
284
13
#include <iostream> #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 1 #include <nlohmann/json.hpp> // macro needed to output the NLOHMANN_JSON_NAMESPACE as string literal #define Q(x) #x #define QUOTE(x) Q(x) int main() { std::cout << QUOTE(NLOHMANN_JSON_NAMESPACE) << std::endl; }
72a02988647ee8a1ff7da932aa5d6f660422686fdad5845076a8efaf8c6dc568
C++
284
11
// This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // This test should not be instrumented. #include <cstdint> #include <cstddef> extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
6c8edf440fadbbb5a4e9f8982329bf881a146ba0f36a92299f80826996823165
C++
285
11
// This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // // A fuzzer with empty target function. #include <cstdint> #include <cstdlib> extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; }
bb47bdc632eff2adec214f7c127d6406e48085349005123934afafa0d6f8bbcf
C++
285
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() {}
edc736a533042f558d1160c250f99b74cc8aedf38c0b5bb6017829cef1d8d6dc
C++
285
16
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // create a JSON object const json object = { {"one", 1}, {"two", 2}, {"three", 2.9} }; // output element with key "two" std::cout << object["two"] << '\n'; }
32c933934eb9093c880d79aed65e19fe631e211eee0518c2344057f573bd01d6
C++
286
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){ CwiseUnaryView<internal::scalar_real_ref_op<double>,Matrix3d> t(m); } int main() {}
bec61ceb345a5b836cc3129b49787bb53129b10296c9b821e97bf6f584627c9e
C++
286
15
#include "../Eigen/Sparse" using namespace Eigen; #ifdef EIGEN_SHOULD_FAIL_TO_BUILD void call_ref(Ref<SparseMatrix<float> > a) { } #else void call_ref(const Ref<const SparseMatrix<float> > &a) { } #endif int main() { SparseMatrix<float> a(10,10); call_ref(a+a); }
c90025f7786e9707868f26ddb755cd07db9dd1ce8d89c605accb7fa282108534
C++
286
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;
747a57468b5a24d5b12af1267817670be8bb31416835a37330a25faa53c61995
C++
287
17
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // create a JSON value json a = 23; // move contents of a to b json b(std::move(a)); // serialize the JSON arrays std::cout << a << '\n'; std::cout << b << '\n'; }
a55c8840aa98d31cdc34c9e42a639bdaee37fcd08142545b1000b4068d7a07f7
C++
288
9
#include "cpu_numa_info.h" /// Based on http://stackoverflow.com/questions/16862620/numa-get-current-node-core void get_cpu_and_node_(int& cpu, int& node) { unsigned long a,d,c; __asm__ volatile("rdtscp" : "=a" (a), "=d" (d), "=c" (c)); node = (c & 0xFFF000)>>12; cpu = c & 0xFFF; }
de5803239cda6494b8c0cb20e9ecdb90b649c19de77edf4b6da7f2115f115589
C++
289
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;
15bfa716deb83d3c33d79beb4b3c984fa09accca81180923e1e22316ae737a67
C++
290
14
#include "../Eigen/Eigenvalues" #ifdef EIGEN_SHOULD_FAIL_TO_BUILD #define SCALAR std::complex<double> #else #define SCALAR float #endif using namespace Eigen; int main() { EigenSolver<Matrix<SCALAR,Dynamic,Dynamic> > eig(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10)); }
fea144f33c23987543759f641177197a5d32a0884fe0342bccad102fdcad4454
C++
291
4
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped().transpose():" << endl << m.reshaped().transpose() << endl; cout << "Here is m.reshaped<RowMajor>().transpose(): " << endl << m.reshaped<RowMajor>().transpose() << endl;
6324edeb3e201160cc343e4b3c404cc1d9157e0d41a47fac67df16d1c96e2f1e
C++
292
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;
49ae8f2f5f972aba37b8cd8b5ef5aea4dfd351afdea594ea9e0ec6fc67d2ac01
C++
293
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; Index count = m.cwiseNotEqual(MatrixXi::Identity(2,2)).count(); cout << "Number of coefficients that are not equal: " << count << endl;
f2a95caa6b2b2bd34ffdb0fb8a1191ba17a556087969fc35f3dd430c3f166148
C++
293
12
#include <torch/extension.h> at::Tensor multi_tensor_l2norm_cuda( int chunk_size, std::vector<std::vector<at::Tensor>> tensor_lists); PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { m.def("l2norm", &multi_tensor_l2norm_cuda, "Computes L2 norm for a list of contiguous tensors"); }
6ce7a04f8f6711ea177f46c96f32dea8877a0c50adadddcedb365181614ccf88
C++
295
4
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.reshaped(2, AutoSize):" << endl << m.reshaped(2, AutoSize) << endl; cout << "Here is m.reshaped<RowMajor>(AutoSize, fix<8>):" << endl << m.reshaped<RowMajor>(AutoSize, fix<8>) << endl;
15b3ac169fc0b7fdceed2b799a9439562638b1b127a27b6b27d86f7862d0795c
C++
297
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; }
32f30e81c422f5b0a4855673771312703dc4bb06b8d266fcdc1e339954f32a1f
C++
297
14
#include <iostream> #include <iomanip> #include <nlohmann/json.hpp> using json = nlohmann::json; using namespace nlohmann::literals; int main() { json j = R"( {"hello": "world", "answer": 42} )"_json; auto val = j["/hello"_json_pointer]; std::cout << std::setw(2) << val << '\n'; }
72ae2ada2942bd34444cc78101a340c991034b81057cc714b1d86a31a9e02873
C++
297
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; }
9a1c66f0db868d3769226bc4db90708b2465f0a4d01b002c01291649e9aa667a
C++
297
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; }
f4418ad1d8e76b22ffd5ea42f7afd65e944d657afee23e1e8f98395298b167f8
C++
297
18
// This is a regression unit regarding a weird linking issue with gcc. #include "bug1213.h" int main() { return 0; } template<typename T, int dim> bool bug1213_2(const Eigen::Matrix<T,dim,1>& ) { return true; } template bool bug1213_2<float,3>(const Eigen::Vector3f&);
7010a8532ecded49d7370fa2a1daa7c18c5d8748fb4e4acf511bf57331bb531b
C++
298
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; }
8a78a897e5bcb50f1634274c7a575cca8be4f5142df896260a010d94463e1807
C++
298
16
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { // implicitly create a JSON null value json j1; // explicitly create a JSON null value json j2(nullptr); // serialize the JSON null value std::cout << j1 << '\n' << j2 << '\n'; }
b78b60fd63eddf542648c3276fb8c4f5a445ac00d531651f7a99d7d1c0e2c67d
C++
298
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topLeftCorner<2,Dynamic>(2,2):" << endl; cout << m.topLeftCorner<2,Dynamic>(2,2) << endl; m.topLeftCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
d1769b37eff521875c72c8b65c3acb64782f358a314b4e841ad39bee9425d7cc
C++
298
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; }
cd5a8759f49133fbe6515b84f4e8eff528d903b4ed6f4d8162a727b7673b8c0d
C++
299
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;
87307097a69c3d4be3d23ffcbbdb6b4b04e2c73bce9691e14e940dfc0a1e6d62
C++
301
16
#include "../Eigen/Sparse" using namespace Eigen; void call_ref(Ref<SparseMatrix<float> > a) { } int main() { SparseMatrix<float> a(10,10); SparseMatrixBase<SparseMatrix<float> > &ac(a); #ifdef EIGEN_SHOULD_FAIL_TO_BUILD call_ref(ac); #else call_ref(ac.derived()); #endif }
92160665bdcc42a5109db11a9b56ca086f1b5b91e39516170d544670aa1aef3e
C++
301
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.topRightCorner<2,Dynamic>(2,2):" << endl; cout << m.topRightCorner<2,Dynamic>(2,2) << endl; m.topRightCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
99a99a1aacd84785f47a309901a076bbea8b8386d39dba6600e7c7bc765478c1
C++
301
9
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 *= B; cout << "After A *= B, A = " << endl << A << endl; A.applyOnTheRight(B); // equivalent to A *= B cout << "After applyOnTheRight, A = " << endl << A << endl;
f18afbdc8b7feb44cffcbf3e3e5a15022ba1ef12e2a513db69ecbc547e67835d
C++
301
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;
1e606e80154fd2c5e3140aabc78d39284687ca4302d1b852dd5589b2d21abd18
C++
303
13
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { json::json_pointer::string_t s = "This is a string."; std::cout << s << std::endl; std::cout << std::boolalpha << std::is_same<json::json_pointer::string_t, json::string_t>::value << std::endl; }
30dcc9c4693cc762c3c9851f2b84e5b0e8fe6288a4f360ab78986c6f6e082de1
C++
303
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;
860eb5cb73f2c09641217f8d36a415389002872ae371d6675dc60dc8f020c67d
C++
304
15
#include <iostream> #include <Eigen/Dense> using namespace Eigen; using namespace std; int main() { Matrix3d m = Matrix3d::Random(); m = (m + Matrix3d::Constant(1.2)) * 50; cout << "m =" << endl << m << endl; Vector3d v(1,2,3); cout << "m * v =" << endl << m * v << endl; }
a922e566fc177d9b9d4a8a05f2c9acd8279a4cf599f1663f93934ab8a250a982
C++
306
16
#include "../Eigen/Sparse" using namespace Eigen; typedef SparseMatrix<double,ColMajor> Mat1; #ifdef EIGEN_SHOULD_FAIL_TO_BUILD typedef SparseMatrix<double,RowMajor> Mat2; #else typedef SparseMatrix<double,ColMajor> Mat2; #endif int main() { Mat1 a(10,10); Mat2 b(10,10); a += b; }
bbdd3ace760b0fc7b60724c1e0ecc554769b970bd2e8e11b7eab103c8633f884
C++
306
7
int array[8]; for(int i = 0; i < 8; ++i) array[i] = i; cout << "Column-major:\n" << Map<Matrix<int,2,4> >(array) << endl; cout << "Row-major:\n" << Map<Matrix<int,2,4,RowMajor> >(array) << endl; cout << "Row-major using stride:\n" << Map<Matrix<int,2,4>, Unaligned, Stride<1,4> >(array) << endl;
dbf549c768b799ac096fd434b4a2678b61d1b18a5db8df07b999c5990282f470
C++
306
12
#include <iostream> #include <nlohmann/json.hpp> using json = nlohmann::json; int main() { std::cout << "JSON for Modern C++ version " << NLOHMANN_JSON_VERSION_MAJOR << "." << NLOHMANN_JSON_VERSION_MINOR << "." << NLOHMANN_JSON_VERSION_PATCH << std::endl; }
4b8ed9eda695501ab8c79615478db5ad4ce95e1d16ef55c97d915186718484b2
C++
307
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomLeftCorner<2,Dynamic>(2,2):" << endl; cout << m.bottomLeftCorner<2,Dynamic>(2,2) << endl; m.bottomLeftCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
4cbacc5694220b97ed0a4315228a83417197f2194e08989ff295c7311f3f6632
C++
307
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;
75b294609786098a3c9e130ddfaca086388eedbf71a4bf791782b5eeebda711d
C++
307
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";
6373c509340636e3a757fd45a900ada07adbf1e00d2f856bc553809d15c243e8
C++
309
11
// Used to extract SVE vector register size (in bits) #include <iostream> #ifdef __ARM_FEATURE_SVE #include <arm_sve.h> inline int sve_length() noexcept { std::cout << svcntb()*8; return 1; } #else inline int sve_length() noexcept { std::cout << 16*8; return 0; } #endif int main() { return sve_length(); }
d1ab4161f30e9fd65609b072aa8c72c4d15ed59a38c05496e5ad8bf5081a31e3
C++
309
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;
ad8b2b2555af8f7d6b29b4a740d14e139b94d2fbbee6c528ae43e127d5ae9f81
C++
310
11
MatrixXf M1(3,3); // Column-major storage M1 << 1, 2, 3, 4, 5, 6, 7, 8, 9; Map<RowVectorXf> v1(M1.data(), M1.size()); cout << "v1:" << endl << v1 << endl; Matrix<float,Dynamic,Dynamic,RowMajor> M2(M1); Map<RowVectorXf> v2(M2.data(), M2.size()); cout << "v2:" << endl << v2 << endl;
bd34e7cd7ee89f7146d6c9cef58897c5e64c457afc3b22fe03c1c385d838ce71
C++
310
6
Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is m.bottomRightCorner<2,Dynamic>(2,2):" << endl; cout << m.bottomRightCorner<2,Dynamic>(2,2) << endl; m.bottomRightCorner<2,Dynamic>(2,2).setZero(); cout << "Now the matrix m is:" << endl << m << endl;
2c02b53b5900b4972a5e1e15d7690a9eb9b94cf51c6324a9e0ed38d90e53e22b
C++
312
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; CwiseUnaryView<internal::scalar_real_ref_op<double>,CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f; } int main() {}
8e7377315db6afccfeba2e8bae31ecb0f18f6f3d215301c97d3045bfc00fa7e1
C++
313
15
#include "gemm_common.h" #include <Eigen/Cholesky> EIGEN_DONT_INLINE void llt(const Mat &A, const Mat &B, Mat &C) { C = A; C.diagonal().array() += 1000; Eigen::internal::llt_inplace<Mat::Scalar, Lower>::blocked(C); } int main(int argc, char **argv) { return main_gemm(argc, argv, llt); }
a786a6a080d29b5108ab8e5530cdc3ddafbb6e939f5e1ce4850ec6b4884daceb
C++
320
15
#include <iostream> #include <Eigen/Dense> using namespace Eigen; using namespace std; int main() { MatrixXd m = MatrixXd::Random(3,3); m = (m + MatrixXd::Constant(3,3,1.2)) * 50; cout << "m =" << endl << m << endl; VectorXd v(3); v << 1, 2, 3; cout << "m * v =" << endl << m * v << endl; }