The copy-and-swap idiom identifies that we can implement a classes copy/move assignment operators in terms of its copy/move constructor and achieve st
Continue ReadingWhy doesn’t GCC optimize a*a*a*a*a*a to (a*a*a)*(a*a*a)?
I am doing some numerical optimization on a scientific application. One thing I noticed is that GCC will optimize the call pow(a,2) by compiling it in
Continue ReadingC++: Black Scholes Call Option Theta
// Calculate the Black Scholes European call option Theta double BS_Call_Option_Theta(double S, double K, double r, double v, double T) // Para
Continue ReadingC++ Programming Tutorial Complete
https://www.youtube.com/watch?v=-WwGMNGRHdw
Continue ReadingC++: Bitmap
Show a basic storage type to handle a simple RGB raster graphics image, and some primitive associated functions. If possible provide a function to
Continue ReadingC++: Pascal’s Triangle
The task is to print out the first 15 Catalan numbers by extracting them from Pascal's triangle. This enables calculation of Catalan Numbers using onl
Continue ReadingC++: Factors of an Integer
Compute the factors of a positive integer. These factors are the positive integers by which the number being factored can be divided to yield a positi
Continue ReadingC++: Forest Fire
Implement the Drossel and Schwabl definition of the forest-fire model. It is basically a 2D cellular automaton where each cell can be in three dist
Continue ReadingC++: Gray Code
Gray code is a form of binary encoding where transitions between consecutive numbers differ by only one bit. This is a useful encoding for reducing ha
Continue ReadingC++: Maze Generation
Generate and show a maze, using the simple Depth-first search algorithm. Start at a random cell. Mark the current cell as visited, and get a l
Continue Reading




