Skip to content

Instantly share code, notes, and snippets.

View dflemstr's full-sized avatar

David Flemström dflemstr

View GitHub Profile
//This doesn't actually work, since function application has the highest precedence in Scala.
def repeat(self: String, times: Int) = self * times
val x = "ABC"
x~repeat(5)
//Linear interpolation of a 2D double array
private double[,] Interpolate(double[,] matrix, int dim)
{
double[,] result = new double[dim, dim];
double sf = (double)(matrix.GetLength(0) - 1) / (double)(dim - 1d);
for (int x = 0; x < dim; x++)
{
for (int y = 0; y < dim; y++)
{