Back when I was new to the world of HPC, I was often confused as to what the distinction was between BLAS and LAPACK. With the wealth of available memory model variants (shared, distributed), vendor implementations, and subroutine naming conventions, the amount of acronyms can get out of hand quickly. The following is a little …

# Tag Archive: algorithms

Jul 22

## Euclidean Algorithm

The Euclidean Algorithm recursively calculates the greatest common divisor (GCD) of two integers. It works because GCD(a,b) = GCD(a mod b, b) = GCD(b, a mod b). Each step of the algorithm reduces the size of the numbers by about a factor of 2. The total number of steps required is roughly log(a*b). It is …

Jul 20

## Calculating Fibonacci Numbers

The following C++ code calculates the Nth number in the Fibonacci sequence. The first routine recursively calculates F_n, however it is very inefficient and takes an unrealistic amount of time to calculate even moderately high values for F_n (say 100). The second routine generates the sequence sequentially on the fly up to F_n, and is …

Jun 28

## Linear Regression in C++

The following is the gradient descent algorithm implemented for linear regression using C++ and the Eigen library:

Jun 28

## Logistic Regression in C++

After taking Andrew Ng’s Machine Learning course, I decided to implement some of the algorithms in C++. The following codes utilize the Eigen template library for linear algebra. Also, I’m no master in C++, therefore take these codes with a grain of salt! In the course itself, a matlab optimization solver (fminunc) is used in …

Feb 13

## Going to School

As an occasional scuba diver, it has been a privilege to see on more than one occasion the majesty that is a school of fish up close. I’ve often wondered what (if anything) is going through any particular fish’s mind as it effortlessly maintains its position in the school. It’s easy to see why some …

## Recent Comments