! * calculates the minimal value in the column. * for \c count = 0, the minimum of all elements is returned. * for \c count > 0, the minimum of the first \p count elements is returned. * for \c count < 0, the minimum of the last \p count elements is returned. */
| 1775 | * for \c count < 0, the minimum of the last \p count elements is returned. |
| 1776 | */ |
| 1777 | double Column::minimum(int count) const { |
| 1778 | if (count == 0 && d->available.min) |
| 1779 | return d->statistics.minimum; |
| 1780 | else { |
| 1781 | int startIndex = 0, endIndex = rowCount() - 1; |
| 1782 | |
| 1783 | if (count > 0) |
| 1784 | endIndex = std::min(rowCount() - 1, count - 1); |
| 1785 | else if (count < 0) |
| 1786 | startIndex = std::max(rowCount() - count, 0); |
| 1787 | |
| 1788 | return minimum(startIndex, endIndex); |
| 1789 | } |
| 1790 | } |
| 1791 | |
| 1792 | /*! |
| 1793 | * \brief Column::minimum |