Skip to content

Instantly share code, notes, and snippets.

View niebayes's full-sized avatar
:octocat:
good to see you

niebayes niebayes

:octocat:
good to see you
  • Datalayers
  • Chengdu Sichuang
View GitHub Profile
@a6y3ap
a6y3ap / JosephusProblem.java
Last active February 2, 2025 15:35
Josephus Problem using Bitwise Operation (Java)
/*
* Solution of Josephus Problem using Bitwise Operation
* Shifting the most-significant set bit of n to the
* least significant bit will return the safe position.
*
* ====================== EXPLANATION ======================
*
* n (41) the number of people standing in the circle
* n = 101001
*
@niebayes
niebayes / Eigen Cheat sheet
Created July 29, 2020 09:52 — forked from gocarlos/Eigen Cheat sheet
Cheat sheet for the linear algebra library Eigen: http://eigen.tuxfamily.org/
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.