// // libsemigroups - C++ library for semigroups and monoids // Copyright (C) 2020 James D. Mitchell // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. //
// Best compiled with: CXXFLAGS="-march=native -mtune=haswell -mssse3 // -ftree-vectorize"
#include <cstddef> // for size_T
#include"bench-main.hpp"// for CATCH_CONFIG_ENABLE_BENCHMARKING #include"catch.hpp"// for REQUIRE, REQUIRE_NOTHROW, REQUIRE_THROWS_AS
#include"libsemigroups/matrix.hpp"// for BMat
#include"../tests/bmat-data.hpp"
namespace libsemigroups { namespace { int myproduct(int x, int y) { return x & y;
}
int mysum(int x, int y) { return x | y;
}
void mymatmult(std::vector<int>& res,
std::vector<int>& A,
std::vector<int>& B) {
size_t m = 40; static std::vector<int> colPtr;
colPtr.resize(40); for (size_t c = 0; c < m; c++) { for (size_t i = 0; i < m; i++) {
colPtr[i] = B[i * m + c];
} for (size_t r = 0; r < m; r++) {
res[r * m + c] = std::inner_product(A.begin() + r * m,
A.begin() + (r + 1) * m,
colPtr.begin(),
0,
mysum,
myproduct);
}
}
}
std::vector<int> to_vec_1d(std::vector<std::vector<int>> const& x) {
std::vector<int> vec; for (size_t i = 0; i < x.size(); ++i) { for (size_t j = 0; j < x[i].size(); ++j) {
vec.push_back(x[i][j]);
}
} return vec;
}
} // namespace
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.