Loading...
Searching...
No Matches
CostModel.h
Go to the documentation of this file.
1// SPDX-License-Identifier: MIT
2// Copyright (c) gpridge developers
3// See LICENSE for details.
4
5// Operation counts that decide between the dense Cholesky backend and the
6// preconditioned Krylov backend for one evaluation of the hyperparameter
7// objective and its gradient. No order cutoff appears: the choice follows
8// from the order, the cost of one operator action, the noise floor, the
9// pivot residual curve and the tolerance the optimizer needs.
10
11#ifndef GPR_LINALG_LINOP_COST_MODEL_H_
12#define GPR_LINALG_LINOP_COST_MODEL_H_
13
14#include <Eigen/Core>
15#include <vector>
16
17namespace gpr::linalg::linop {
18
22[[nodiscard]] double denseObjectiveFlops(Eigen::Index order,
23 Eigen::Index hyperparameters);
24
26 Eigen::Index order = 0;
27 Eigen::Index hyperparameters = 0;
28 double matvec_flops = 0.0;
29 double column_flops = 0.0;
30 double noise_floor = 0.0;
31 double relative_tolerance = 0.0;
32 Eigen::Index probes = 0;
34 std::vector<double> residual_trace;
35};
36
37struct KrylovPlan {
38 Eigen::Index rank = 0;
39 double iterations = 0.0;
40 double flops = 0.0;
41};
42
45[[nodiscard]] double krylovObjectiveFlops(const KrylovObjectiveInputs& in,
46 Eigen::Index rank);
47
51
52} // namespace gpr::linalg::linop
53
54#endif // GPR_LINALG_LINOP_COST_MODEL_H_
KrylovPlan planKrylovObjective(const KrylovObjectiveInputs &in)
Definition CostModel.cpp:49
double krylovObjectiveFlops(const KrylovObjectiveInputs &in, Eigen::Index rank)
Definition CostModel.cpp:26
double denseObjectiveFlops(Eigen::Index order, Eigen::Index hyperparameters)
Definition CostModel.cpp:15
double column_flops
one column read while pivoting
Definition CostModel.h:29
double noise_floor
smallest added diagonal entry
Definition CostModel.h:30
std::vector< double > residual_trace
Bound on tr(A0 - F_r F_r^T) by rank r = 0, 1, ...
Definition CostModel.h:34
double matvec_flops
one operator action on one column
Definition CostModel.h:28