public static GaPoTNumFrame CreateFromColumns(double[,] matrix) { var rowsCount = matrix.GetLength(0); var colsCount = matrix.GetLength(1); var frame = new GaPoTNumFrame(); for (var j = 0; j < colsCount; j++) { var vector = new GaPoTNumVector(); for (var i = 0; i < rowsCount; i++) { var value = matrix[i, j]; if (value == 0) { continue; } vector.AddTerm(i + 1, value); } frame.AppendVector(vector); } return(frame); }
public static GaPoTNumFrame CreateBasisFrame(int vectorsCount) { var frame = new GaPoTNumFrame(); for (var i = 0; i < vectorsCount; i++) { var vector = new GaPoTNumVector().AddTerm(i + 1, 1.0d); frame.AppendVector(vector); } return(frame); }