Ben Chuanlong Du's Blog

It is never too late to learn.

Variables in Java

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

  1. There are 3 different types of variables in Java: instance variables, local variables and argument variables. An instance variables will be initialized to default values if it is not initialized manually …

Convert Math Formula and Table To LaTeX

R

  1. xtable{xtable}

    • Good for converting table to LaTeX code.
  2. latex{Hmisc}

    • Convert R objects (not just tables) to LaTeX code.

Excel

MATLAB

Mathematica

  1. Type in the formula in Mathematica.

  2. Selected the formula.

  3. Right click on selection, and then select "Copy as" -> "LaTeX".

  4. You can also convert formulas to other …

Sorting Functions in C++

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

std::sort std::stable_sort std::partial_sort

Notice that only std::stable_sort is stable sort (at the cost of additional time/space complexity). It is easy to achive stable sort using std …

Good C++ Libraries

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Good C++ Libraries

  1. Armadillo: linear algebra
  2. it++: signal processing
  3. shogun: a large scale machine learning toolbox
  4. boost: an advanced general purpose C++ library
  5. dlib: a general purpose cross-platform C++ library designed …

Profile C++ Code

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

You can use valgrind with the following options

valgrind --tool=callgrind ./(Your binary)

It will generate a file called callgrind.out.x. You can then use kcachegrind tool to read this …

Erase Elements of a Container Using Iterator in C++

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

@TODO: make a general discuss about removing elements form containers ...

vector -> best to remove backwards ...

You cannot erase elements from a container using the function std::for_each or the range-based for …