I have a CSV file which contains a matrix of correlation coefficients between a set of objects (in the example below it is four objects u101, u102, u103, u104). The files uses the object names as row names and column names like so:
u101, u102, u103, u104
u101, 1.0, 0.2, 0.1, 0.4
u102, 0.2, 1.0, 0.5, 0.8
u103, 0.1, 0.5, 1.0, 0.9
u104, 0.4, 0.8, 0.9, 1.0
What I now need to do is: read the CSV file into some matrix format in Java such that I can access the correlation coefficients by name. Basically, I need to implement a function:
double getValue(String arg0, String arg1) {
[…]
}
When invoked with
getValue("u101", "u104")
the function should then return 0.4.
How can I do that?