int nRows = (Integer.valueOf(str[0].trim())).intValue();
int nColumns = (Integer.valueOf(str[1].trim())).intValue();
// int nNonZeros = (Integer.valueOf(str[2].trim())).intValue();
// now we're into the data section
IDoubleArray matrix = API.doublesNew.sparseMatrix(nRows, nColumns);
double x;
while ((line = br.readLine()) != null)
{
str = line.split("( )+");
int i = (Integer.valueOf(str[0].trim())).intValue();
int j = (Integer.valueOf(str[1].trim())).intValue();
if(str.length < 3) // for pattern matrices set a dummy value of 1.
x = 1;
else
x = (Double.valueOf(str[2].trim())).doubleValue();
matrix.set(i - 1, j - 1, x);
}
br.close();
return matrix;
}