Skip to content

XiaoxingChen/mxm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mxm

A header-only/compiled C++ numerical compute library.

$$\Huge A_{m \times m}$$

Features

1. Dense Matrix Operation

2. Geometry

3. None-linear Optimization

4. Graph

5. Toy Demos

Code Sample

  • 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.

Installation

Linux/MacOS

git clone https://github.com/XiaoxingChen/mxm
cd mxm
./build.py --test

Windows

git clone https://github.com/XiaoxingChen/mxm
cd mxm
python build.py --test

Dependents

  • c++17
  • STL

Related Blogs and Links

  1. A 4D CPU Ray Tracing Renderer based on mxm: ray_tracing_4d
  2. Blog: Dual Number and Auto Derivative of Special Orthogonal Group
  3. Blog: Geometries for N-Dimensional Ray Tracing
  4. Zhihu: How to implement Auto Differentiation in C++?(Chinese)

About

Header-only/compiled C++ numerical compute library.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages