A header-only/compiled C++ numerical compute library.
- N-Dimensional Matrix/Vector Operation [mxm/linalg_mat.h]
- Real
- Complex [mxm/linalg_complex.h]
- Quaternion [mxm/linalg_complex.h]
- Dual Number [mxm/linalg_dual_number.h]
- QR Decomposition/solver (Real, Complex) [mxm/linalg_solve.h]
- Eigenvalue Decomposition (Real, by shifted QR Iteration).
- Singular Value Decomposition (Real).
- 2-D, 3-D, N-D Rotation
- Logarithmic/Exponential Map for
$SO(n)$ and$\mathfrak{so}(n)$ [mxm/lie_special_orthogonal.h] - Conversion between Axis/Plane-Angle, Rotation Matrix, Quaternion [mxm/full_dimensional_rotation.h]
- Spherical Linear Interpolation
- Logarithmic/Exponential Map for
- N-D Ray [mxm/geometry_ray.h]
- N-D Pinhole Camera (3D Radial Tangential Distortion) [mxm/model_camera.h]
- N-D Simplex(line segment, triangle, tetrahedron ...) [mxm/geometry_primitive.h]
- N-D Rigidbody Transform [mxm/rigid_transform.h]
- N-D Affine Transform [mxm/transform_affine.h]
- N-D BVH Tree [mxm/spatial_bvh.h]
- Ray Closest-Hit/Any-Hit/Multi-Hit
- Radius Search
- Nearest Neighbor Search
- N-D Metric Tree (for any metric space) [mxm/spatial_metric_tree.h]
- Gauss-Newton Method [mxm/optimize.h]
- Auto Derivative(based on Dual Number) 🌟 🌟
- Sparse Jacobian Acceleration for SfM [mxm/optimize_sfm_gn.h]
- Directed/Undirected Weighted/Unweighted Graph [mxm/graph_base.h]
- Shortest Path [mxm/graph_dijkstra.h]
- Dijkstra
- Bellman Ford
- Flow Network [mxm/graph_flow.h]
- Fulkerson Ford Max Flow
- Optical Flow [mxm/cv_optical_flow.h]
- Pinhole Camera Calibration [mxm/cv_calibration.h]
- QR decomposition and linear equation
#include "mxm/linalg.h"
using namespace mxm;
Matrix<float> mat_a = random::uniform({5,5});
Vector<float> vec_b = random::uniform({5,1});
auto qr = qr::decomposeByRotation(mat_a);
auto vec_x = qr::solve(mat_a, vec_b);
- 4D Rotation
#include "mxm/rotation.h"
using namespace mxm;
// Rotation::fromPlaneAngle() is available for any dimensional rotation.
Rotation<double> r1 = Rotation::fromPlaneAngle({1,0,0,0}, {0,1,0,0}, 0.5);
auto v1 = r1.apply({1,2,3,4});
- Pinhole Camera Intrinsic Calibration
#include "mxm/cv_calibration.h"
#include "mxm/optimize_sfm_gn.h"
using namespace mxm;
Camera<DType, 3> cam_guess(cam);
cam_guess.setFocalLength(Vector<DType>{500, 500});
cam_guess.setPrincipalOffset(Vector<DType>{250, 0.5 * 752});
cam_guess.setDistortion(Distortion<DType>::radialTangential({0,0,0,0}));
PinholeCameraIntrinsicEstimator<DType> problem(pts3d, pts2d);
problem.initialGuess(pose_guess, cam_guess);
problem.solve(5, 0);
For more code samples, see tests/test_main.cpp.
git clone https://github.com/XiaoxingChen/mxm
cd mxm
./build.py --test
git clone https://github.com/XiaoxingChen/mxm
cd mxm
python build.py --test
- c++17
- STL
- A 4D CPU Ray Tracing Renderer based on
mxm
: ray_tracing_4d - Blog: Dual Number and Auto Derivative of Special Orthogonal Group
- Blog: Geometries for N-Dimensional Ray Tracing
- Zhihu: How to implement Auto Differentiation in C++?(Chinese)