gtsam
Loading...
Searching...
No Matches
Ring.h
Go to the documentation of this file.
1/* ----------------------------------------------------------------------------
2
3 * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4 * Atlanta, Georgia 30332-0415
5 * All Rights Reserved
6 * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7
8 * See LICENSE for the license information
9
10 * -------------------------------------------------------------------------- */
11
18
19#pragma once
20
22struct Ring {
23 static inline double zero() { return 0.0; }
24 static inline double one() { return 1.0; }
25 static inline double add(const double& a, const double& b) { return a + b; }
26 static inline double max(const double& a, const double& b) {
27 return a > b ? a : b;
28 }
29 static inline double mul(const double& a, const double& b) { return a * b; }
30 static inline double div(const double& a, const double& b) {
31 return (a == 0 || b == 0) ? 0 : (a / b);
32 }
33 static inline double id(const double& x) { return x; }
34 static inline double negate(const double& x) { return -x; }
35};
The Real ring with addition and multiplication.
Definition Ring.h:22