When using a DenseMatrix from Math .NET, and I want to access the second column, third row, do I write matrix[1,2]
or matrix[2,1]
in other words, does the first index determine the row or the column?
Asked
Active
Viewed 2,391 times
0

Christoph Rüegg
- 4,626
- 1
- 20
- 34

dmi_
- 1,187
- 2
- 12
- 26
-
1matrix[2,1], row first and then the column (syntax is the same as At() method, it follows math standard conventions). – Adriano Repetti Jun 19 '12 at 18:31
-
2Thank you both. I could have tested this on my own, and I realize it's easily answered with a test, but I asked the question to spare others the trouble - this is information that should be stated clearly on the web, I believe. – dmi_ Jun 19 '12 at 18:34
1 Answers
2
A quick search yields this documentation:
http://api.mathdotnet.com/Numerics/MathNet.Numerics.LinearAlgebra.Double/DenseMatrix.htm
While it's lacking in what you're asking, it does have a RowCount property you can interrogate to find your answer.
Running a test now
It's [row, column]
.
public virtual T this[int row, int column]
{
get
{
RangeCheck(row, column);
return At(row, column);
}
set
{
RangeCheck(row, column);
At(row, column, value);
}
}

Austin Salonen
- 49,173
- 15
- 109
- 139