Returns the minimum value stored in this vector @return the minimum value in this vector
()
| 432 | * @return the minimum value in this vector |
| 433 | */ |
| 434 | public double min() |
| 435 | { |
| 436 | if (isSparse() && nnz() < length()) |
| 437 | { |
| 438 | double min = 0.0; |
| 439 | for (IndexValue iv : this) |
| 440 | min = Math.min(min, iv.getValue()); |
| 441 | return min; |
| 442 | } |
| 443 | else |
| 444 | { |
| 445 | double min = get(0); |
| 446 | for (int i = 1; i < length(); i++) |
| 447 | min = Math.min(min, get(i)); |
| 448 | return min; |
| 449 | } |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * Returns the maximum value stored in this vector |