Merge cmatrix

Fixes #24