Skip to content

Instantly share code, notes, and snippets.

View vvrs's full-sized avatar

Vishnu vvrs

View GitHub Profile

Concept-based polymorphism in modern C++

Date 05-05-2021 - 10-17-2023
Revision R3
Author Guillaume Dua
Reviewers Loïc Joly, Antoine Morrier
@vvrs
vvrs / eigen_sor.cpp
Last active February 17, 2023 07:38
#include <iostream>
#include <Eigen/Core>
/**
* Solve the linear system Ax=b using the Successive Over Relaxation (SOR) method.
*
* @tparam Scalar The scalar type of the matrix and vectors (e.g., float, double).
* @tparam Rows The number of rows of the matrix and vectors.
* @tparam Cols The number of columns of the matrix (ignored for vectors).
* @param A The matrix A of the linear system (Matrix<Scalar, Rows, Cols>).
@vvrs
vvrs / eigen_json_serialization.cpp
Created September 22, 2021 01:58
Serialize and deserialize Eigen Matrix using jsoncpp
#include <iostream>
#include <sstream>
#include <string>
#include <Eigen/Core>
#include <vector>
#include <memory>
#include "json/json.h"
template<typename EigenType>
@vvrs
vvrs / derived_class_1.cpp
Last active September 22, 2021 02:34
cereal with multi-level polymorphism
#include "derived_class_1.h"
#include <iostream>
void DerivedClassOne::sayType()
{
std::cout << "DerivedClassOne " << x <<std::endl;
std::cout << "Call say type from DerivedClassOne's children " <<std::endl;
sayType2();
}
@vvrs
vvrs / Eigen Cheat sheet
Created July 6, 2021 05:12 — 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.
@vvrs
vvrs / compiler_install.sh
Created April 28, 2020 15:36
Install different versions of gcc and g++. Update alternatives.
#!/bin/sh
sudo apt install build-essential
sudo apt -y install gcc-6 g++-6 gcc-7 g++-7 gcc-8 g++-8 gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
@vvrs
vvrs / inria-41005S02-toc.txt
Created December 9, 2017 16:06 — forked from artob/inria-41005S02-toc.txt
INRIA Mobile Robots and Autonomous Vehicles MOOC
Mobile Robots and Autonomous Vehicles
by INRIA, via the FUN MOOC platform
https://www.france-universite-numerique-mooc.fr/courses/inria/41005S02/session02/about
Introduction
Course presentation
Guide: Learning Platform
Guide: Discussion Forums