29#ifndef DIPLA_USE_EIGEN
31#define DIPLA_USE_EIGEN 0
80 int size() const noexcept {
return static_cast<int>(dipla::aigenlib::Vector::size()); }
84 int cols() const noexcept {
return 1; }
87 if (column != 0)
throw std::out_of_range(
"Vector column must be zero");
98 return std::all_of(begin(), end(), [](
double value) {
return std::isfinite(value); });
101 double sum()
const {
return std::accumulate(begin(), end(), 0.0); }
105 for (
const double value : *
this)
result = std::hypot(
result, value);
110 if (
size() != other.
size())
throw std::invalid_argument(
"Vector dimensions differ");
111 for (
int index = 0; index <
size(); ++index) (*
this)[index] += other[index];
118 for (
int index = 0; index <
size(); ++index)
error = std::hypot(
error, (*
this)[index] - other[index]);
166template <
class Number>
168 static_assert(std::is_floating_point_v<Number>,
"Matrix4 needs floating-point scalars");
173 constexpr int rows() const noexcept {
return 4; }
175 constexpr int cols() const noexcept {
return 4; }
177 constexpr int size() const noexcept {
return 16; }
187 result.values_.fill(value);
193 for (
int index = 0; index < 4; ++index)
result(index, index) =
Scalar(1);
198 return std::all_of(
values_.begin(),
values_.end(), [](
Scalar value) { return std::isfinite(value); });
203 for (
int index = 0; index < 4; ++index)
result += (*
this)(index, index);
210 for (
int column = 0; column < 4; ++column)
result(
row, column) = (*this)(column,
row);
217 for (
int column = 0; column < 4; ++column) {
218 for (
int inner = 0; inner < 4; ++inner) {
219 const Scalar factor = right(inner, column);
230 if (
row < 0 || row >= 4 || column < 0 || column >= 4)
throw std::out_of_range(
"Matrix4 index");
231 return static_cast<std::size_t
>(column * 4 +
row);
245using MatrixXd = Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor>;
255inline constexpr const char*
backend =
"eigen";
257inline constexpr const char*
build_info =
"DIPLA_MATH_BACKEND=eigen";
270inline constexpr const char*
backend =
"aigenlib";
272inline constexpr const char*
build_info =
"DIPLA_MATH_BACKEND=aigenlib";
Bounded, owning numerical types and Gaussian-process operations.
Owning, zero-initialized 4-by-4 column-major value matrix.
constexpr int cols() const noexcept
Column count.
bool allFinite() const
Validate all entries.
Scalar & operator()(int row, int column)
Checked mutable element.
static Matrix4 Constant(Scalar value)
Construct a constant value.
std::array< Scalar, 16 > values_
constexpr int size() const noexcept
Scalar count.
Scalar operator()(int row, int column) const
Checked element.
Matrix4 operator*(const Matrix4 &right) const
Multiply two owning values.
static Matrix4 Identity()
Construct the identity.
static std::size_t offset(int row, int column)
Validate an element address.
constexpr int rows() const noexcept
Row count.
Scalar trace() const
Sum the diagonal.
static Matrix4 Zero()
Allocate a zero value.
Matrix4 transpose() const
Return an owning transpose.
aigenlib storage with the planner's signed dimensions and finite predicate.
int size() const noexcept
Signed scalar count.
int cols() const noexcept
Signed column count.
static Matrix Zero(std::size_t rows, std::size_t columns)
Allocate zero storage.
bool allFinite() const noexcept
Test every scalar.
Matrix()=default
Construct an empty matrix.
int rows() const noexcept
Signed row count.
Matrix(dipla::aigenlib::Matrix value)
Accept an owning kernel result.
aigenlib point with familiar initialization and finite-check spelling.
bool allFinite() const noexcept
Validate coordinates.
void setZero() noexcept
Reset every coordinate to zero.
static Point Zero()
Construct the origin.
Point(const dipla::aigenlib::Point &point)
Accept the result of value arithmetic.
Point eval() const
Return a value, never an expression.
Bounded owning vector with the planner's small Eigen-style value API.
bool allFinite() const
Validate every scalar.
Vector(dipla::aigenlib::Vector values)
Accept owning kernel output.
Vector eval() const
Produce a value, never an expression.
bool isApprox(const Vector &other, double tolerance) const
Relative norm comparison.
int size() const noexcept
Signed vector length.
static Vector Constant(std::size_t count, double value)
Allocate a constant.
double sum() const
Sum all entries.
int rows() const noexcept
Matrix-compatible row count.
int cols() const noexcept
Matrix-compatible column count.
static std::size_t checked_size(std::size_t count)
Validate before allocating.
Vector(std::size_t count=0, double value=0.0)
Allocate initialized scalars.
static Vector Zero(std::size_t count)
Allocate zeros.
double norm() const
Stable Euclidean length.
Vector & operator+=(const Vector &other)
Add a same-sized vector.
double operator()(std::size_t row, std::size_t column) const
Checked matrix-style access.
Owning, contiguous, row-major double matrix.
std::size_t cols() const noexcept
Column count.
std::size_t size() const noexcept
Allocated scalar count.
Matrix()=default
Construct an empty matrix.
bool finite() const noexcept
Validate all stored scalars.
std::size_t rows() const noexcept
Row count.
uint8_t row[LWIR_MAX_WIDTH *3U]
struct jpeg_error_mgr error
Matrix4< double > Matrix4d
Vector operator+(Vector left, const Vector &right)
Add owning vectors.
Matrix4< float > Matrix4f
constexpr const char * build_info
constexpr const char * backend
std::vector< double > Vector
constexpr std::size_t max_extent
Three-dimensional value type for route arithmetic.
double & y() noexcept
Access north.
bool finite() const noexcept
Check every coordinate.
Point(double east=0.0, double north=0.0, double altitude=0.0)
Construct a point.
double & x() noexcept
Access east.
double & z() noexcept
Access altitude.
One timestamped geographic position for a replay annotation.
struct usher_control_result result