GPRidge v1.0.0
GPR-accelerated saddle point searches on potential energy surfaces
☾
Toggle main menu visibility
Loading...
Searching...
No Matches
OzakiScheme.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: MIT
2
// Copyright (c) gpridge developers
3
#pragma once
4
5
#include <Eigen/Core>
6
#include <cmath>
7
#include <limits>
8
#include <vector>
9
10
namespace
gpr::linalg
{
11
12
// Slice products are accumulated as scaled integers and rounded once.
13
18
int
schemeISliceBits
(Eigen::Index length);
19
20
struct
SchemeISlices
{
21
int
bits
= 0;
22
std::vector<Eigen::VectorXd>
slices
;
23
};
24
27
SchemeISlices
splitSchemeI
(
const
Eigen::Ref<const Eigen::VectorXd>& values);
28
30
double
accumulateSchemeI
(
const
SchemeISlices
& left,
const
SchemeISlices
& right);
31
33
double
schemeIProductRaw
(
const
double
* left,
const
double
* right,
int
length);
34
37
template
<
typename
Left,
typename
Right>
38
double
schemeIProduct
(
const
Eigen::MatrixBase<Left>& left,
39
const
Eigen::MatrixBase<Right>& right)
40
{
41
if
(left.rows() != right.rows() || left.cols() != right.cols() ||
42
left.size() > std::numeric_limits<int>::max()) {
43
return
std::numeric_limits<double>::quiet_NaN();
44
}
45
Eigen::VectorXd left_terms(left.size());
46
Eigen::VectorXd right_terms(right.size());
47
Eigen::Index term = 0;
48
for
(Eigen::Index column = 0; column < left.cols(); ++column) {
49
for
(Eigen::Index row = 0; row < left.rows(); ++row, ++term) {
50
left_terms(term) = left(row, column);
51
right_terms(term) = right(row, column);
52
}
53
}
54
return
accumulateSchemeI
(
splitSchemeI
(left_terms),
55
splitSchemeI
(right_terms));
56
}
57
58
}
// namespace gpr::linalg
gpr::linalg
Dense and structured linear algebra behind the GP: Cholesky and eigen solvers, linear operators,...
Definition
ConditionedKernel.h:14
gpr::linalg::schemeIProductRaw
double schemeIProductRaw(const double *left, const double *right, int length)
Scheme I product of two length-n factors in term order.
Definition
OzakiScheme.cpp:122
gpr::linalg::schemeIProduct
double schemeIProduct(const Eigen::MatrixBase< Left > &left, const Eigen::MatrixBase< Right > &right)
Definition
OzakiScheme.h:38
gpr::linalg::schemeISliceBits
int schemeISliceBits(Eigen::Index length)
Definition
OzakiScheme.cpp:33
gpr::linalg::accumulateSchemeI
double accumulateSchemeI(const SchemeISlices &left, const SchemeISlices &right)
Sum the exact slice products. The split and this accumulation are separate.
Definition
OzakiScheme.cpp:102
gpr::linalg::splitSchemeI
SchemeISlices splitSchemeI(const Eigen::Ref< const Eigen::VectorXd > &values)
Definition
OzakiScheme.cpp:42
gpr::linalg::SchemeISlices
Definition
OzakiScheme.h:20
gpr::linalg::SchemeISlices::slices
std::vector< Eigen::VectorXd > slices
Definition
OzakiScheme.h:22
gpr::linalg::SchemeISlices::bits
int bits
Definition
OzakiScheme.h:21
gpr
linalg
OzakiScheme.h
Generated by
1.17.0
Generated by
Doxygen 1.17.0
Analytics by
Antics
provided by
TurtleTech ehf