I am trying to convert this C # code to F #:
double[,] matrix;
public Matrix(int rows, int cols)
{
this.matrix = new double[rows, cols];
}
public double this[int row, int col]
{
get
{
return this.matrix[row, col];
}
set
{
this.matrix[row, col] = value;
}
}
Basically my biggest problem is creating an indexer in F #. I could not find anything that I could apply in this situation anywhere on the Internet. I included a couple of other parts of the class in case the inclusion of an indexer in a matrix type is not obvious. So a good answer would include how to make a full three-part type here, plus everything you might need. Also, I know the type of matrix in Powerpack F #, however I am trying to learn F # by converting C # projects that I understand into F #.
Thanks in advance,
Bean
source
share