sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
cb9490eca4e1b2cad422f0ef9bb8107e7ffce23fd6224126ac957d3808fc6885
C++
421
22
// Copyright (c) 2018 Mike Dev // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at // https://www.boost.org/LICENSE_1_0.txt) #include <boost/atomic.hpp> struct Dummy { int x[128]; }; int main() { Dummy d = {}; boost::atomic<Dummy> ad; ...
7471654f36f99a8b2dddbe2898ea3435e77e2fc48aaa9f0e5dfcae1dc418fd59
C++
422
27
#include "mex.h" #include "matrix.h" void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { if(nrhs != 1) { printf(" wrong usage!!!.\n\n"); return; } int pcnt = 0; const mxArray *Str; Str = prhs[0]; char *str; str = (char *) mxCalloc(mxGetN(Str)+1, sizeof(c...
2a52d2a32c9e493a492b8edb1f7f1444c3affcb08d9b6233fae26566058961f4
C++
424
19
#include "helpers.h" #include <catch2/catch.hpp> #include <lsl_cpp.h> TEST_CASE("bounce", "[basic][latency]") { auto sp = create_streampair(lsl::stream_info("bounce", "Test")); float data = .0; BENCHMARK("single bounce") { sp.out_.push_sample(&data); sp.in_.pull_sample(&data, 1.); }; sp.out_.push_sample(&da...
5d3cb30654ecac90f0687befa114309470ba290148a16b46cffe9bebe5c32f5f
C++
426
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); cout << "The inverse square root of A is: " << endl; cout << es.operatorInverseSqrt() << endl; cout << "We can also compute i...
2192ded2e8265d8e2721129d8af8ef82ed6f890cf03d42addc854ef71030eb9d
C++
429
10
MatrixXd A = MatrixXd::Random(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; RealSchur<MatrixXd> schur(A); cout << "The orthogonal matrix U is:" << endl << schur.matrixU() << endl; cout << "The quasi-triangular matrix T is:" << endl << schur.matrixT() << endl << endl; MatrixXd U = schur...
4f79a4232ea4a2fea8eb02ee400b9ebdbf0fbe312a2a575a58646dfa38542a8c
C++
430
9
MatrixXd A = MatrixXd::Random(6,6); cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl; EigenSolver<MatrixXd> es(A); MatrixXd D = es.pseudoEigenvalueMatrix(); MatrixXd V = es.pseudoEigenvectors(); cout << "The pseudo-eigenvalue matrix D is:" << endl << D << endl; cout << "The pseudo-eigenvector mat...
cd010c3cf352b73d913732c88bebc3f841409019ec7992f60c84a89ad1bb423e
C++
431
15
#include <stdexcept> #include <boost/exception/exception.hpp> #include <boost/throw_exception.hpp> struct hex_decode_error : virtual boost::exception, virtual std::exception {}; struct not_enough_input : virtual hex_decode_error {}; struct non_hex_input : virtual hex_decode_error {}; void toss() { BOOST_THROW_EXC...
812df6b71175fae57c2e63f55cf6fe6b6eb0c69fe553c75b1d472202f2b6fd44
C++
433
9
Matrix3d m = Matrix3d::Zero(); m.part<Eigen::UpperTriangular>().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d n = Matrix3d::Ones(); n.part<Eigen::LowerTriangular>() *= 2; cout << "Here is the matrix n:" << endl << n << endl; cout << "And now here is m.inverse()*n, taking advantage of the fac...
6ea861ac2fbeff80d0f3a0f9a8fc27ca01212d39b1a9fd72a02c735513e1ebe9
C++
434
16
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { const double pi = std::acos(-1.0); MatrixXd A(2,2); A << cos(pi/3), -sin(pi/3), sin(pi/3), cos(pi/3); std::cout << "The matrix A is:\n" << A << "\n\n"; std::cout << "The matrix square root of A is:...
e46924bfe9cda39d9fd181a382c4cac070a4528b06b8cc425203b08e2ad4f791
C++
434
13
#ifndef _MSC_VER #warning deprecated #endif /* Matrix3d m = Matrix3d::Zero(); m.part<Eigen::StrictlyUpperTriangular>().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; cout << "And let us now compute m*m.adjoint() in a very optimized way" << endl << "taking advantage of the symmetry." << endl; Ma...
54238cbe5311f8cffd950cbd0ac1aeabf3b157f52be78ab38ae68107d573a2f6
C++
439
29
#include "tests.h" #include "emittertests.h" #include "parsertests.h" #include "spectests.h" #include "yaml.h" #include <fstream> #include <sstream> #include <vector> #include <iostream> namespace Test { void RunAll() { bool passed = true; if(!RunParserTests()) passed = false; if(!RunEmitterTests()) ...
bf6d9e27ce74629220ad7d029c6ede0da715345bf14a41b04cc640ff0ae68e9f
C++
440
24
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Eigen::MatrixXf m(2,4); Eigen::VectorXf v(2); m << 1, 23, 6, 9, 3, 11, 7, 2; v << 2, 3; MatrixXf::Index index; // find nearest neighbour (m.colwise() - v).colwise().squaredNorm()...
8b604ea385c9af9040258c0698e71e456f84b26f2cd1c970bc910232bfd2b31e
C++
441
10
MatrixXf m = MatrixXf::Random(3,5); cout << "Here is the matrix m:" << endl << m << endl; LU<MatrixXf> lu(m); // allocate the matrix ker with the correct size to avoid reallocation MatrixXf ker(m.rows(), lu.dimensionOfKernel()); lu.computeKernel(&ker); cout << "Here is a matrix whose columns form a basis of the kernel ...
ee4c3ff4439d077c3ea3ad76e88a020b35c6b29805029a5e0345a45253b03695
C++
444
22
#include <Eigen/Dense> #include <iostream> using namespace Eigen; using namespace std; int main() { MatrixXf m(2,2); MatrixXf n(2,2); MatrixXf result(2,2); m << 1,2, 3,4; n << 5,6, 7,8; result = (m.array() + 4).matrix() * m; cout << "-- Combination 1: --" << endl << result << endl << e...
546286f6381f9dd6019d8fc4c890ef51d97c02d108ef63bc3d426ebc102f5e05
C++
445
9
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 << "Th...
a9c799e889d65a1fd926aab68bb418c920fbefbdbacfc35250c4e343e2c8b372
C++
445
15
#include "SoloRead.h" void SoloRead::record(uint64 nTr, Transcript **alignOut, uint64 iRead, ReadAnnotations &readAnnot) { if (pSolo.type==pSolo.SoloTypes::None) return; if (pSolo.type==pSolo.SoloTypes::CB_samTagOut) return; if (pSolo.readStats.yes) readFlagReset(); ...
e34016511b146661bfd9507d908e06df074c420340c75db7e2829a9dc4bcf677
C++
447
19
// intmax_c.cpp --------------------------------------------------------------// // Copyright 2010 Vicente J. Botet Escriba // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt #include <boost/cstdint.hpp> #ifdef INTMAX_C #define BOOST_INTMAX_C(a) INTMAX_C(a...
f59797b5c8d312c1b2c8d3623c8322e1a25df23ca3b517dd20d3d5f99d970e62
C++
448
17
#include <Eigen/Dense> #include <iostream> using namespace std; int main() { Eigen::Matrix4f m; m << 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,12, 13,14,15,16; cout << "m.leftCols(2) =" << endl << m.leftCols(2) << endl << endl; cout << "m.bottomRows<2>() =" << endl << m.bottomRows<2>() << endl << ...
48174f5dc7e10e4849a8428936857764739ff8bb295e8eea84be17d871930aee
C++
449
18
/*<- Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ //[ has_void_return #include <type_traits> #include <boost/callable_traits/has_void_return.hpp> namespace ct = boost::callable_traits; ...
44a90612f0e18ad9e32f542feba50f2992535f67321728dacb2a11a099b91581
C++
454
11
//---------------------------------------------------------------------------// // Copyright (c) 2017 Kohei Takahashi // // 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 // // See http://boostorg.github.com/compute f...
ad9246c1c3a027b670831a409991e7c68694265fac8bc5c76487952f7d88705c
C++
455
24
#include "parserstate.h" namespace YAML { ParserState::ParserState() { // version version.isDefault = true; version.major = 1; version.minor = 2; } const std::string ParserState::TranslateTagHandle(const std::string& handle) const { std::map <std::string, std::string>::const_iterator it = tags.find(han...
8288d71e32bbd8312148735333add0b16275b7c0dd04c7cf79254ada8735e69e
C++
456
26
#include <Eigen/Core> USING_PART_OF_NAMESPACE_EIGEN using namespace std; template<typename Scalar, typename Derived> void foo(const MatrixBase<Scalar, Derived>& m) { cout << "Here's m:" << endl << m << endl; } template<typename Scalar, typename Derived> Eigen::ScalarMultiple<Derived> twice(const MatrixBase<Scalar...
c673ca5eaa43effed0014e3b7059c7008edc367fee4fa6a4d3d12cde63e53c0f
C++
456
8
typedef Matrix<float,Dynamic,2> DataMatrix; // let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise) DataMatrix samples = DataMatrix::Random(12,2); VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1; // and let's solve samples * [x y]^T = elevations in lea...
07ed07a0fdce1430c3e35cd4cad0280a3d52a3ff47fac239b7d63b77e01e0ab0
C++
459
8
typedef Matrix<float,Dynamic,2> DataMatrix; // let's generate some samples on the 3D plane of equation z = 2x+3y (with some noise) DataMatrix samples = DataMatrix::Random(12,2); VectorXf elevations = 2*samples.col(0) + 3*samples.col(1) + VectorXf::Random(12)*0.1; // and let's solve samples * [x y]^T = elevations in lea...
56b9cece0eb2a7eca713c152a7be0a6bd8446fef955a3e5b4e57d49fedc66ac7
C++
460
17
// Copyright (c) 2017 Andrey Semashev // // 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/atomic.hpp> int main(int, char *[]) { // The test verifies that atomic<> does not provide arithmet...
21dcd382c39d5a02e0144e982e0e0c17b64a1575c8ce4c7c0e04d3fb552d5ce3
C++
465
12
Matrix2f M = Matrix2f::Random(); Matrix2f m; m = M; cout << "Here is the matrix m:" << endl << m << endl; cout << "Now we want to replace m by its own transpose." << endl; cout << "If we do m = m.transpose(), then m becomes:" << endl; m = m.transpose(); cout << m << endl << "which is wrong!" << endl; cout << "Now let u...
a9cdf8194d212249cc95862fa10651fdeb7a5b4548bef254094c6c8f92d80342
C++
465
29
/* * David Gleich * Copyright, Stanford University, 2006-2007 */ /** * @file libmbgl_test.cc * Implement a unit test for libmbgl */ /**History * 31 July 2007 * Initial version */ #include "matlab_bgl.h" int main(int argc, char **argv) { mbglIndex ai[] = {0}; mbglIndex aj[] ...
d88af667b1be7cb5c8f0cc962d84b22ee5af6202034496894df7db7483ce23ff
C++
465
24
/* Copyright 2018 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #include <boost/align/aligned_allocator.hpp> struct S; struct V { }; void value_test() { boost::alignment::aligned_allocator<S> a; (void)a; } void...
1b58c29f9254e83959982f6d54b830c5646a15afe1c1b61f9ca90557aa8fc5c9
C++
466
24
#include <Eigen/Dense> #include <iostream> using namespace Eigen; using namespace std; int main() { ArrayXXf m(2,2); // assign some values coefficient by coefficient m(0,0) = 1.0; m(0,1) = 2.0; m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0); // print values to standard output cout << m << endl << endl; ...
b611e97c544a3386d8336f0e6d8baf1a3b3fc2e5cadd9f0df6548af574dd59cb
C++
467
12
Matrix2f M = Matrix2f::Random(); Matrix2f m; m = M; cout << "Here is the matrix m:" << endl << m << endl; cout << "Now we want to copy a column into a row." << endl; cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl; m.col(1) = m.row(0); cout << m << endl << "which is wrong!" << endl; cout << "Now let us ...
4c6fc953fe0ae24d4cd399ac6c7e89c198cd2cbde6451fd5213c5a938f8356cc
C++
468
15
typedef Matrix<float,2,3> Matrix2x3; typedef Matrix<float,3,2> Matrix3x2; Matrix2x3 m = Matrix2x3::Random(); Matrix2f y = Matrix2f::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix y:" << endl << y << endl; Matrix3x2 x; if(m.lu().solve(y, &x)) { assert(y.isApprox(m*x)); co...
d9e728a63fc28c28586140f7a90dd3e1f65d445b59e197961be6964dab677aea
C++
468
12
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...
e394b7bdef97f4b943f40f1a536bb3de4e434f97d860cec0885f821e079600ba
C++
468
12
// // Copyright (c) 2016-2021 Vinnie Falco (vinnie dot falco at gmail dot com) // Copyright (c) 2021 Richard Hodges (hodges.r@gmail.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) // // Official repository: ...
87aa574cbf6ebae69fdf19540c459903524592e19a64bd9e00f1a18522eab098
C++
469
23
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; std::complex<double> expfn(std::complex<double> x, int) { return std::exp(x); } int main() { const double pi = std::acos(-1.0); MatrixXd A(3,3); A << 0, -pi/4, 0, pi/4, 0, 0, 0, 0, 0; std::...
43aabd06049d3165ffd0d4bfcb90f37820221afd725696d0f3adbd50754b30b2
C++
471
22
#include <iostream> #include <Eigen/Dense> using namespace Eigen; int main() { Matrix2d a; a << 1, 2, 3, 4; MatrixXd b(2,2); b << 2, 3, 1, 4; std::cout << "a + b =\n" << a + b << std::endl; std::cout << "a - b =\n" << a - b << std::endl; std::cout << "Doing a += b;" << std::endl; a += b;...
c177047ad8d60f292c047aa715a82ca8ab2b68ab4edce333c7d3e8965fc9e407
C++
471
24
#include "yaml.h" #include <fstream> #include <iostream> int main(int argc, char **argv) { std::ifstream fin; if(argc > 1) fin.open(argv[1]); std::istream& input = (argc > 1 ? fin : std::cin); try { YAML::Parser parser(input); YAML::Node doc; while(parser.GetNextDocument(doc)) { YAML::Emitter emitter;...
5128177446093f0b58fbb4febd6455bcb0cd32c99e88092c75205b0b7730a55d
C++
475
10
MatrixXd X = MatrixXd::Random(5,5); MatrixXd A = X + X.transpose(); cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl; VectorXd diag(5); VectorXd subdiag(4); internal::tridiagonalization_inplace(A, diag, subdiag, true); cout << "The orthogonal matrix Q is:" << endl << A << endl; cout << "Th...
5489d242247cb6d8be26601fa5d67d2fe7d6350b91bd7965c940f1074fca8808
C++
477
17
#define CATCH_CONFIG_RUNNER #include <catch2/catch.hpp> extern "C" { const char *lsl_library_info() { return LSL_VERSION_INFO; } } int main(int argc, char *argv[]) { Catch::Session session; #ifdef _WIN32 session.configData().waitForKeypress = Catch::WaitForKeypress::BeforeExit; #endif session.configData().runOrder...
6e720282ed5ae47aa775bb86a547c0625d222933527383039aee93e27c0bae29
C++
478
17
#include "cancellation.h" #include <loguru.hpp> lsl::cancellable_registry::~cancellable_registry() {} lsl::cancellable_obj::~cancellable_obj() { unregister_from_all(); } void lsl::cancellable_obj::unregister_from_all() { try { for (auto obj : registered_at_) obj->unregister_cancellable(this); registered_at_.cle...
5e0b3d98e6b9b4d98cbeb9375c3892833b8f80163486582172fe48d14faaf0c3
C++
479
8
Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the upper-triangular matrix extracted from m:" << endl << m.part<Eigen::UpperTriangular>() << endl; cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl << m.part<Eigen::Strictly...
fadaa04451e4dd23690c1a7d421f3364fa3e044329d5367c8adebc29546de65b
C++
480
18
#include <loguru.hpp> #include <thread> // Include loguru before catch #include <catch2/catch.hpp> // clazy:excludeall=non-pod-global-static TEST_CASE("loguru_thread_local_storage", "[threading]") { char name[16] = "0"; loguru::set_thread_name("1"); std::thread([&]() { loguru::set_thread_name("2"); loguru::get...
b83287c2d022a2a8847fbe2c13422f3f635070db8d881ffffb9a11f03a86a153
C++
481
15
// Copyright 2021 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include <boost/bind/apply.hpp> #include <boost/core/lightweight_test_trait.hpp> #include <boost/core/is_same.hpp> int main() { BOOST_TEST_TRAIT_TRUE((boost::core::is_same<void, boo...
66694239de5f9f56d6faffb5d3ddb3c6ff7dd14562b3d5ac3704f448b9b3822a
C++
482
9
Matrix4d A = Matrix4d::Random(4,4); cout << "Here is a random 4x4 matrix:" << endl << A << endl; HessenbergDecomposition<Matrix4d> hessOfA(A); Matrix4d pm = hessOfA.packedMatrix(); cout << "The packed matrix M is:" << endl << pm << endl; cout << "The upper Hessenberg part corresponds to the matrix H, which is:" <...
2cec1981b65ecc20947e09071379db23eeba154d5c7bbc12553a0a0d6f0a6b4a
C++
483
20
/*<- Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ //[ is_const_member #include <type_traits> #include <boost/callable_traits/is_const_member.hpp> namespace ct = boost::callable_traits; ...
c83f0f5544ddf226ded79edc67ddd822bac67c4cb69146af9eb02d0692017282
C++
483
22
// Copyright (c) 2017 Andrey Semashev // // 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/atomic.hpp> struct foo { int n; }; int main(int, char *[]) { // The test verifies that atomic...
6023adc7d4800882d725d367117832b0d1495dcc019d40ef202cc18da1b63325
C++
484
14
#ifndef _MSC_VER #warning deprecated #endif /* Matrix3d m = Matrix3d::Zero(); m.part<Eigen::UpperTriangular>().setOnes(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3d n = Matrix3d::Ones(); n.part<Eigen::LowerTriangular>() *= 2; cout << "Here is the matrix n:" << endl << n << endl; cout << "And now h...
9022ad7897958c874f8cab9a0eee7b663979a28fede444cc0e9fd9e87c13deee
C++
489
18
#include <iostream> #include <Eigen/Dense> using namespace Eigen; int main() { MatrixXd m(2,5); m.resize(4,3); std::cout << "The matrix m is of size " << m.rows() << "x" << m.cols() << std::endl; std::cout << "It has " << m.size() << " coefficients" << std::endl; VectorXd v(2); v.resize(5); ...
973e4732fff065281767a54791f6fe5a67ff56e68d4664829f271c258474dfdd
C++
494
7
Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones()); Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwise().abs(); // 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.cwise()<p0).al...
a5f8c58d679a15fb0299996c5997dc4a3ef6dfe526543d3a74842810d53f216d
C++
494
25
/** * Copyright (c) 2016-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #include "matrix.h" namespace fasttext { Matrix::Matrix() : m_(0), n_(0) {} Matrix::Matrix(int64_t m, int64_t...
4aa2338dd8bed8afde1f610784ef349972b920ac7ee5654cbd404012780e1282
C++
502
20
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { MatrixXf mat(2,4); mat << 1, 2, 6, 9, 3, 1, 7, 2; MatrixXf::Index maxIndex; float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex); std::cout << "Maximum sum at position " << maxIndex << std:...
52bd551abd090454da602bef43bc45ada81befeb5e2bce15182e9042eefe9fe3
C++
503
24
// // timer.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 <iostream> #include <boost/asio.hpp> in...
05e4f1d89173b71d3a2150cbe1956fef3f1ecba7f3418e68d2dff86e924e35b9
C++
504
13
MatrixXd m(3,3); m << 1,1,0, 1,3,2, 0,1,1; cout << "Here is the matrix m:" << endl << m << endl; LU<Matrix3d> lu(m); // allocate the matrix img with the correct size to avoid reallocation MatrixXd img(m.rows(), lu.rank()); lu.computeImage(&img); cout << "Notice that the middle column is the sum of the two oth...
c326d4266356cd9a2e827bdb76b7be2d9139ce95c3cceace0a22f2b1cb38eb90
C++
505
15
// chrono.cpp --------------------------------------------------------------// // Copyright Beman Dawes 2008 // Copyright Vicente J. Botet Escriba 2009-2010 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // define BOOST_CHRONO_SOURCE so that <boost/fil...
56a74b2fecddd00e4d395da1824cd35accc9a042c2a652c8e5b5be66b6033093
C++
508
20
#include <Eigen/Dense> #include <iostream> using namespace Eigen; void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src) { dst.triangularView<Upper>() = src.triangularView<Upper>(); } int main() { MatrixXf m1 = MatrixXf::Ones(4,4); MatrixXf m2 = MatrixXf::Random(4,4); std::cout << "m2 before copy:"...
7dad838d7b443760ddc93a7759d272fb351aa1c74b91365fa0cf057da7e194f9
C++
508
18
#include "cancellation.h" #include <exception> #include <loguru.hpp> lsl::cancellable_registry::~cancellable_registry() = default; lsl::cancellable_obj::~cancellable_obj() { unregister_from_all(); } void lsl::cancellable_obj::unregister_from_all() { try { for (auto *obj : registered_at_) obj->unregister_cancellab...
c026f5ad32bd2ce1e8a3ab3031839032f7030e7038259a9bb7d2e83145b42047
C++
508
20
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { MatrixXd A = MatrixXd::Random(3,3); std::cout << "A = \n" << A << "\n\n"; MatrixXd sinA = A.sin(); std::cout << "sin(A) = \n" << sinA << "\n\n"; MatrixXd cosA = A.cos(); std::cout << "cos(A) = \n" << cos...
241943a5f2936e909f81510ba6380778f2e3142a36183e1c69c055749d59bae6
C++
513
21
#include <Eigen/Dense> #include <iostream> using namespace std; using namespace Eigen; int main() { ArrayXXf a(2,2); a << 1,2, 3,4; cout << "(a > 0).all() = " << (a > 0).all() << endl; cout << "(a > 0).any() = " << (a > 0).any() << endl; cout << "(a > 0).count() = " << (a > 0).count() << endl...
d7a1a02fba584a55637f75853e076adafc06518e153968eb764ed8e5b6f4ff85
C++
513
15
//---------------------------------------------------------------------------// // Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.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 // // See http://boostorg.gi...
bdd1b6c91a6f287eadc5c22655a6884aa18b5d7a2fe02d7e966bc947c1cf50e4
C++
514
17
#include <Eigen/Core> #include <Eigen/Array> USING_PART_OF_NAMESPACE_EIGEN using namespace std; // define a custom template binary functor template<typename Scalar> struct MakeComplexOp EIGEN_EMPTY_STRUCT { typedef complex<Scalar> result_type; complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { re...
b856ba94e32647746d8e087d56ddae47930174d198c8bc4b4d6b7b483ffe7275
C++
516
18
#define EIGEN2_SUPPORT #include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; int main() { Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; Matrix3i n = Matrix3i::Random(); cout << "And here is the matrix n:" << endl << n << endl; cout << ...
84290c9a7640997307528fc7a81e057505bd64a6601e8b627a3bd2f6b6e35c5a
C++
519
12
MatrixXd A(3,3); A << 4,-1,2, -1,6,0, 2,0,5; cout << "The matrix A is" << endl << A << endl; LLT<MatrixXd> lltOfA(A); // compute the Cholesky decomposition of A MatrixXd L = lltOfA.matrixL(); // retrieve factor L in the decomposition // The previous two lines can also be written as "L = A.llt().matrixL()" cout << "T...
45be3f9b856ad38a48a6ad5afe1863a9733a79b4575924e509491f9aec6bbc96
C++
521
19
// Copyright 2015 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. //#define BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #include <boost/chrono.hpp> #include <boost/chro...
a7fc029b40c0fca61a8dda9f5a317eddc75b65c1021e5b25790eb41764055eec
C++
523
18
#include <Eigen/Dense> #include <iostream> using namespace std; using namespace Eigen; int main() { Array22f m; m << 1,2, 3,4; Array44f a = Array44f::Constant(0.6); cout << "Here is the array a:" << endl << a << endl << endl; a.block<2,2>(1,1) = m; cout << "Here is now a with m copied into its cent...
e6b42ad308cf129c3ea648e0940e61da65bffc0c17a1d4cb172e95a12ad8ed2b
C++
523
7
Vector3f boxMin(Vector3f::Zero()), boxMax(Vector3f::Ones()); Vector3f p0 = Vector3f::Random(), p1 = Vector3f::Random().cwiseAbs(); // let's check if p0 and p1 are inside the axis aligned box defined by the corners boxMin,boxMax: cout << "Is (" << p0.transpose() << ") inside the box: " << ((boxMin.array()<p0.array(...
f9e51e96f063c830ff1000e45c6aec92eaeb1fa229f8f88c03a8609cb9baa932
C++
523
22
#include "../common/create_streampair.hpp" #include "../common/lsltypes.hpp" #include <catch2/catch.hpp> #include <lsl_cpp.h> // clazy:excludeall=non-pod-global-static TEST_CASE("bounce", "[basic][latency]") { auto sp = create_streampair(lsl::stream_info("bounce", "Test")); float data = .0; BENCHMARK("single boun...
9e732744a70ac06c04ef9076e19d7f9bd681a39bc394a524da7caa99dab02959
C++
524
20
#include <unsupported/Eigen/MatrixFunctions> #include <iostream> using namespace Eigen; int main() { MatrixXf A = MatrixXf::Random(3,3); std::cout << "A = \n" << A << "\n\n"; MatrixXf sinhA = A.sinh(); std::cout << "sinh(A) = \n" << sinhA << "\n\n"; MatrixXf coshA = A.cosh(); std::cout << "cosh(A) = \n"...
156b9d1aca255ec81d78e80426e4ac5932cb3eb9143a7fdad31ed1d8d71ea23a
C++
525
18
Matrix<int, 3, 4, ColMajor> Acolmajor; Acolmajor << 8, 2, 2, 9, 9, 1, 4, 4, 3, 5, 4, 5; cout << "The matrix A:" << endl; cout << Acolmajor << endl << endl; cout << "In memory (column-major):" << endl; for (int i = 0; i < Acolmajor.size(); i++) cout << *(Acolmajor.data() + i) << " "; cout << endl...
0b1b120de161d66fc39a26951d4f7b5405c51b6ba7112825b7acbf6a0109fb91
C++
526
17
/* * Copyright Andrey Semashev 2020. * 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 <emmintrin.h> int main(int, char*[]) { __m128i mm = _mm_setzero_si128(); mm = _...
0f3c77e013949eb9c91e6b690ea894e19d97944d6b0885b82806fc3ad99680cf
C++
526
24
#include "zfstream.h" int main() { // Construct a stream object with this filebuffer. Anything sent // to this stream will go to standard out. gzofstream os( 1, ios::out ); // This text is getting compressed and sent to stdout. // To prove this, run 'test | zcat'. os << "Hello, Mommy" << endl; os <<...
5c34a22c07d5650a277e60f12523a63184a087a29d48ac0c46201e78c174918a
C++
526
17
/* * Copyright Andrey Semashev 2020. * 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 <smmintrin.h> int main(int, char*[]) { __m128i mm = _mm_setzero_si128(); mm = _...
df48e09977f67a0b1c52914863439cfa80922ab58b82de98f1937d548e00125a
C++
526
18
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; // define a custom template binary functor template<typename Scalar> struct MakeComplexOp { EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp) typedef complex<Scalar> result_type; complex<Scalar> operator()(const Scalar& a, const Scalar& b...
75decdc8aaad7f2d9cda01a1fbd2c843b63595bf8e23eb6f606fc593c9de4889
C++
527
19
/* Copyright (c) Marshall Clow 2010-2012. 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) For more information, see http://www.boost.org */ #include <vector> #include <boost/algorithm/searching/boyer_moor...
a586ee82660bea52303db9ef2dff71dc4ccbb3c0d08923ca07e204a0ff86d449
C++
529
16
#include <iostream> #include <Eigen/Dense> using namespace std; int main() { Eigen::Matrix2d mat; mat << 1, 2, 3, 4; cout << "Here is mat.sum(): " << mat.sum() << endl; cout << "Here is mat.prod(): " << mat.prod() << endl; cout << "Here is mat.mean(): " << mat.mean() ...
d5e802001cd34263f1a17a7657c9e3ae649d30068c5cb16fc7450a235dd8e050
C++
531
26
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Eigen::MatrixXf m(2,2); m << 1, 2, 3, 4; //get location of maximum MatrixXf::Index maxRow, maxCol; float max = m.maxCoeff(&maxRow, &maxCol); //get location of minimum MatrixXf::Index minRow, m...
86ee67069f7519cf21e85b2b7fd07942b969515344eb4194c6537483387f9b94
C++
534
18
#include <iostream> #include <Eigen/Dense> using namespace std; using namespace Eigen; int main() { Matrix2f A; A << 1, 2, 2, 3; cout << "Here is the matrix A:\n" << A << endl; SelfAdjointEigenSolver<Matrix2f> eigensolver(A); if (eigensolver.info() != Success) abort(); cout << "The eigenvalues of A ...
dd0304f3ae10bd24295e6948c16c27fb20a0cfa296f476a6835d359d64f291fc
C++
534
21
/*<- Copyright Barrett Adair 2016-2017 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http ://boost.org/LICENSE_1_0.txt) ->*/ //[ function_types_remove_const_comparison #include <type_traits> #include <boost/callable_traits/remove_member_const.hpp> struct foo {...
c2ec0d0c3fc75550332c9f19251a5a9b4ca29e93ffee2e73717063b3878c32a4
C++
536
10
MatrixXi m = MatrixXi::Random(3,4); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the rowwise reverse of m:" << endl << m.rowwise().reverse() << endl; cout << "Here is the colwise reverse of m:" << endl << m.colwise().reverse() << endl; cout << "Here is the coefficient (1,0) in the rowise reve...
a89c21c2bea8d7e7d232af6847b69a41adf534c039ee3c74b17e0f5237ddcc9f
C++
539
22
/*<- Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ #include <boost/callable_traits/detail/config.hpp> //[ class_of #include <type_traits> #include <boost/callable_traits/class_of.hpp> na...
2852d3b664600666d2454e9bb2de45fd76dc91247690e344bf6e47c5c0f4780a
C++
541
13
#ifndef _MSC_VER #warning deprecated #endif /* deprecated Matrix3i m = Matrix3i::Random(); cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the upper-triangular matrix extracted from m:" << endl << m.part<Eigen::UpperTriangular>() << endl; cout << "Here is the strictly-upper-triangular matr...
6dfd03a4071cab8a6c17ad7e4ae23023f58ae99620d682f9f5a3c5a86d283fbd
C++
541
22
// run_timer_example.cpp ---------------------------------------------------// // Copyright Beman Dawes 2006, 2008 // Copyright 2009/2010 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 f...
1cb19cdac27fde6d62ddd84afc1a00504ec6dee122cc3d3e10c2314bd8cca826
C++
545
21
// Copyright 2015 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. //#define BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 #define BOOST_CHRONO_VERSION 2 #include <iostrea...
d30230abac1b3f025bb69352252e6c5c7bca561b160cb6f2e85bee51a789ef36
C++
545
29
// Unit test for boost::any. // // See http://www.boost.org for most recent version, including documentation. // // Copyright Antony Polukhin, 2013-2022. // // 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). ...
e89fc67be576b51a495a7767d0c9093178ca76588f3f6edbadbddac7ff2984af
C++
545
23
// Copyright 2019 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // http://www.boost.org/LICENSE_1_0.txt #include <boost/assert/source_location.hpp> #include <boost/core/lightweight_test.hpp> int main() { { boost::source_location loc, loc2; BOOST_TEST_EQ( loc, loc2 ); ...
f084c865586b889400a30b50fc13544962f283905b8e227f6d6657a0b07f0cbf
C++
547
18
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) // // Official repository: https://github.com/boostorg/beast // // If including Wind...
2c08748aff662041e524219feb02c7389bbb58296fc229702a265ccf8926750b
C++
548
18
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) // // Official repository: https://github.com/boostorg/beast // // If including Wind...
cf727d4c9a6846b4a8a6dd6b3931f2d2504a5b6bf3b62e739e2fde1faca57907
C++
548
18
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) // // Official repository: https://github.com/boostorg/beast // // If including Wind...
fcc3c6d4bb73a8844b5c4de3099b33934c760922c14e042cd30a24cf8957a460
C++
548
18
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) // // Official repository: https://github.com/boostorg/beast // // If including Wind...
0cf31e4c8f8049a9baa6aad6dce661188ba17cc30cf0f58fb5e1ddcc8caf7d6e
C++
551
29
/*<- Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ #include <boost/callable_traits/detail/config.hpp> #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES int main(){} #else //[ add_noexcept #i...
c581bcb3791d10008311a796b91cd9d211a2caebda44d26f88d38e0689efb455
C++
551
18
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) // // Official repository: https://github.com/boostorg/beast // // If including Wind...
b4111557d1ebb4b940693dc3dac01900f2878faa1f9a4e19ee8cc5dc30161fd3
C++
552
13
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 extra...
0734a948da0ba5d5315e4472f571b84376b63f3e0c0ab3d81d4c00a564fed4a6
C++
553
18
// // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail 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) // // Official repository: https://github.com/boostorg/beast // // If including Wind...
c5bafdb51e04a6babe7d3151849ce0863aeeb392c585ac8b27a93fade05ebadf
C++
553
25
// // current_function_test2.cpp - a test for boost/current_function.hpp // // Copyright 2018 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/current_function.hpp> #include <boo...
1f57c2ce933a136ff47400ee5f404fec50db2389f282297cf457dc1c5cccebe3
C++
555
34
// // arg_copy_test.cpp - copying a custom placeholder _1 to arg<1> // // Copyright 2016 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/is_placeholder.hpp> #include <boost/b...
3389b5c78e3c33727d7eb63f5e0bf9a2373069b9c987c61f1f67bc1310c750d9
C++
560
19
// Copyright Antony Polukhin, 2017-2022. // // 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) // This tests the issue from https://svn.boost.org/trac/boost/ticket/12052 #include <iostream> #include <boost/any.hpp...
93efbb6db2794ea409db5cf2d38fdea5590eb46076eaed70000108f75dd52b49
C++
561
19
#include <Eigen/Core> #include <iostream> using namespace Eigen; using namespace std; // define a custom template unary functor template<typename Scalar> struct CwiseClampOp { CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {} const Scalar operator()(const Scalar& x) const { return x<m_...
053a4474dd360343bebd1d0ab9ae187f8616fab1955cc6d6bac3aa6ba9ab6a74
C++
563
29
/*<- Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ #include <boost/callable_traits/detail/config.hpp> #ifndef BOOST_CLBL_TRTS_ENABLE_NOEXCEPT_TYPES int main(){} #else //[ remove_noexcept...
d13754b2eddd255776b2155be7f3f50e9c30106416373aa8959c769c677b8d0d
C++
564
24
/* Copyright (c) Marshall Clow 2014. 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) For more information, see http://www.boost.org */ #include <iostream> #include <boost/config.hpp> #include <boost/algo...
a8b27ec4c182a7ea9d7501dd9ab8ede438216a64cc91475f778a639c155484ef
C++
565
19
//#include "SpliceGraph.h" //void SpliceGraph::swTraceBack(array<typeSeqLen, 2> &alignEnds, array<typeSeqLen, 2> &alignStarts) //{ // uint32 row = alignEnds[0]; // uint32 col = alignEnds[1]; // uint32 rowT = 0; // uint32 colT = 0; // while(col > 0 && row > 0 && scoringMatrix[col][...
2a69e46b889885950dc9d4ea739eebbdd88026efb28f0e94fd6606c7abbf900b
C++
568
31
// // quick.cpp - a quick test for boost/bind/bind.hpp // // Copyright 2017 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/bind/bind.hpp> #include <boost/core/lightweight_test...
7b77370e57e8dc50a6c616b425711f8db321c1e59c239b9ebae6a1867e88a80a
C++
569
24
/*<- Copyright (c) 2016 Barrett Adair Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) ->*/ //[ is_invocable #include <type_traits> #include <boost/callable_traits/is_invocable.hpp> namespace ct = boost::callable_traits; struct...