35 const Index nt = (n + tile - 1) / tile;
36 const double last = double(n - (nt - 1) * tile);
37 const double full = double(tile);
40 const double nfull_lower = double(nt - 1) * double(nt - 2) / 2.0;
41 double elements = nfull_lower * full * full;
42 elements += double(nt - 1) * last * full;
43 elements += double(nt - 1) * full * full + last * last;
44 return 8.0 * elements;
50 throw std::runtime_error(
"SymmetricTiles: tile size must be positive");
55 ntiles_ = (n + tile - 1) / tile;
57 std::size_t total = 0;
59 for (
Index J = 0; J <=
I; ++J) {
60 offset_[std::size_t(
I * (
I + 1) / 2 + J)] = total;
66 data_.reset(
new double[total]);
80 for (
Index J = 0; J <=
I; ++J) {
84 std::memcpy(dest, values + j0, std::size_t(len) *
sizeof(
double));
89#pragma omp parallel for schedule(dynamic)
92 T.triangularView<Eigen::StrictlyUpper>() = T.transpose();
98 double factor)
const {
100 throw std::runtime_error(
"SymmetricTiles::Multiply: matrix not built");
102 if (X.rows() !=
n_) {
103 throw std::runtime_error(
"SymmetricTiles::Multiply: size mismatch");
105 Eigen::MatrixXd Y(
n_, X.cols());
108#pragma omp parallel for schedule(dynamic)
112 auto Yi = Y.middleRows(i0, bi);
114 for (
Index J = 0; J <=
I; ++J) {
std::vector< std::size_t > offset_
void Allocate(Index n, Index kind, Index tile=DefaultTile)
Eigen::Map< const Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > ConstRowMajorMap
Eigen::Map< Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > > RowMajorMap
double operator()(Index i, Index j) const
Element (i, j), for tests.
std::unique_ptr< double[]> data_
void FinishBuild()
Fills the upper halves of the diagonal tiles; marks the matrix built.
double * TileData(Index I, Index J) const
static double Bytes(Index n, Index tile=DefaultTile)
Bytes the tiles of an n x n matrix need.
Eigen::MatrixXd Multiply(const Eigen::MatrixXd &X, double factor=1.0) const
factor * S * X
void SetRowLower(Index r, const double *values)
Row r, columns 0..r (values[0..r]); rows may be set in parallel.
Index TileStart(Index I) const
Index TileSize(Index I) const
Charge transport classes.
Provides a means for comparing floating point numbers.