private static VectorN FromMatrixInternal(ObjectMatrix <double> matrix) { if (matrix.Columns != 1) { throw new InvalidCastException("matrix must have only 1 column"); } var vector = new VectorN(matrix.Rows); for (var index = 0; index < matrix.Rows; index++) { vector[index] = matrix.GetValue(index, 0); } return(vector); }