Loading...
Searching...
No Matches
aigenlib.cpp
Go to the documentation of this file.
48/** @brief Check extents before multiplication. @param rows Rows. @param columns Columns. @return Scalar count. */
59 return std::all_of(values.begin(), values.end(), [](double value) { return std::isfinite(value); });
62/** @brief Validate the operator before indexed kernels run. @param sensor Operator. @param cells Cell count. */
64 if (cells > max_extent || sensor.rows.size() > max_extent || sensor.variances.size() != sensor.rows.size()) {
73 if (index < 0 || static_cast<std::size_t>(index) >= cells) throw std::out_of_range("aigenlib sensor cell index");
85/** @brief Factor the lower triangle in place. @param factor Scaled symmetric workspace. @return Whether positive definite. */
107/** @brief Apply two triangular solves. @param factor Lower Cholesky factor. @param result Scaled RHS, replaced by solution. */
118 for (std::size_t column = 0; column < result.cols(); ++column) destination[column] /= coefficients[row];
126 for (std::size_t column = 0; column < result.cols(); ++column) destination[column] -= coefficient * source[column];
152 const double tolerance = jacobi_epsilon_multiplier * std::numeric_limits<double>::epsilon() * std::max(scale, 1.0);
172 diagonal(index, second) = diagonal(second, index) = sine * before_first + cosine * before_second;
197bool Point::finite() const noexcept { return std::isfinite(x()) && std::isfinite(y()) && std::isfinite(z()); }
199 for (std::size_t index = 0; index < coordinates.size(); ++index) coordinates[index] += other[index];
203 for (std::size_t index = 0; index < coordinates.size(); ++index) coordinates[index] -= other[index];
218bool operator==(const Point& left, const Point& right) noexcept { return left.coordinates == right.coordinates; }
270 if (system.rows() != system.cols() || right.rows() != system.rows() || !system.finite() || !right.finite()) {
275 for (std::size_t column = 0; column < system.cols(); ++column) scale = std::max(scale, std::abs(system(row, column)));
282 if (std::abs(lower - upper) > symmetry_epsilon_multiplier * std::numeric_limits<double>::epsilon()) {
292 for (std::size_t column = 0; column < right.cols(); ++column) result(row, column) = right(row, column) / scale;
300 for (std::size_t index = 0; index < system.rows(); ++index) largest = std::max(largest, std::abs(scaled(index, index)));
309 for (std::size_t column = 0; column < right.cols(); ++column) coefficients[column] += weight * source[column];
315 for (std::size_t column = 0; column < result.cols(); ++column) destination[column] += weight * coefficients[column];
350 for (std::size_t column = 0; column < covariance.cols(); ++column) destination[column] += source[column];
388double expected_reduction(const Matrix& covariance, const std::vector<bool>& mask, const Sensor& sensor) {
391 if (mask.size() != covariance.rows()) throw std::invalid_argument("Invalid aigenlib importance mask");
399 if (!std::isfinite(variance)) throw std::invalid_argument("Nonfinite aigenlib selected variance");
401 for (std::size_t row = 0; row < projected.rows(); ++row) reduction += projected(row, column) * solved(row, column);
409void condition(Matrix& covariance, Vector* mean, const Sensor& sensor, const Vector* measurement) {
424 for (std::size_t row = 0; row < residual.size(); ++row) residual[row] = (*measurement)[row] - residual[row];
428 for (std::size_t column = 0; column < solved.cols(); ++column) updated_mean[column] += source[column] * residual[row];
430 if (!finite_vector(updated_mean)) throw std::overflow_error("Nonfinite aigenlib posterior mean");
463 for (std::size_t column_begin = 0; column_begin < covariance.cols(); column_begin += update_columns) {
Bounded, owning numerical types and Gaussian-process operations.
aigenlib storage with the planner's signed dimensions and finite predicate.
Definition compat.hpp:51
Bounded owning vector with the planner's small Eigen-style value API.
Definition compat.hpp:72
Matrix & operator=(const Matrix &other)
Deep assignment with strong exception guarantee.
Definition aigenlib.cpp:223
Definition aigenlib.cpp:42
bool operator!=(const Point &left, const Point &right) noexcept
Exact inequality.
Definition aigenlib.cpp:219
bool operator==(const Point &left, const Point &right) noexcept
Exact equality.
Definition aigenlib.cpp:218
Vector observe(const Sensor &sensor, const Vector &field)
Average field values through a sensor.
Definition aigenlib.cpp:376
Matrix matern32(const std::vector< Point > &positions, double sigma2, double lengthscale)
Construct a symmetric Matern-3/2 covariance over supplied positions.
Definition aigenlib.cpp:324
double expected_reduction(const Matrix &covariance, const std::vector< bool > &mask, const Sensor &sensor)
Sum the masked posterior diagonal reduction without modifying belief.
Definition aigenlib.cpp:388
Matrix project(const Sensor &sensor, const Matrix &covariance)
Project covariance through sparse averaging rows: B = H P.
Definition aigenlib.cpp:342
Matrix solve_symmetric(const Matrix &system, const Matrix &right, SolveMethod *method)
Solve a finite symmetric system with multiple right-hand sides.
Definition aigenlib.cpp:269
constexpr double pseudoinverse_relative_cutoff
Definition aigenlib.hpp:35
void condition(Matrix &covariance, Vector *mean, const Sensor &sensor, const Vector *measurement)
Condition a GP in place with optional measurement assimilation.
Definition aigenlib.cpp:409
Matrix innovation(const Sensor &sensor, const Matrix &projected)
Construct innovation covariance S = H P H^T + R from B = H P.
Definition aigenlib.cpp:359
Point(double east=0.0, double north=0.0, double altitude=0.0)
Construct a point.
Definition aigenlib.cpp:187
One timestamped geographic position for a replay annotation.
Definition ear_heatmap_overlay.c:79