This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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++) | |
{ |