public static void Sort(Altaxo.Gui.Worksheet.Viewing.WorksheetController ctrl, bool ascending) { Altaxo.Collections.IAscendingIntegerCollection selectedDataColumns = ctrl.SelectedDataColumns; if (0 == selectedDataColumns.Count) { selectedDataColumns = Altaxo.Collections.ContiguousIntegerRange.FromStartAndCount(0, ctrl.DataTable.DataColumnCount); } if (0 == ctrl.SelectedPropertyColumns.Count || 0 == selectedDataColumns.Count) { return; } Altaxo.Data.Sorting.SortDataColumnsByPropertyColumn(ctrl.DataTable, selectedDataColumns, ctrl.DataTable.PropCols[ctrl.SelectedPropertyColumns[0]], ascending); }
private static bool IsEquidistant(double[] x, Altaxo.Collections.IAscendingIntegerCollection indices, double relthreshold) { if (indices.Count <= 1) { return(true); } int N = indices.Count; double first = x[indices[0]]; double last = x[indices[N - 1]]; double spanByNM1 = (last - first) / (N - 1); double threshold = Math.Abs(relthreshold * spanByNM1); for (int i = 0; i < N; i++) { if (Math.Abs((x[indices[i]] - first) - i * spanByNM1) > threshold) { return(false); } } return(true); }
/// <summary> /// Constructor /// </summary> /// <param name="collection">Collection of <see>DataColumns</see>.</param> /// <param name="selectedColumns">Set set of indices into the collection that are part of the matrix.</param> /// <param name="nRows">The number of rows that are part of the matrix. (Starting from index 0).</param> public DataColumnToColumnMatrixWrapper(Altaxo.Data.DataColumnCollection collection, Altaxo.Collections.IAscendingIntegerCollection selectedColumns, int nRows) { _columns = new Altaxo.Data.INumericColumn[selectedColumns.Count]; for (int i = selectedColumns.Count - 1; i >= 0; i--) { _columns[i] = (Altaxo.Data.INumericColumn)collection[selectedColumns[i]]; } _rows = nRows; }