# HG changeset patch # User Chris Cannam # Date 1383243911 0 # Node ID ac3dd9a9d92418bddb9fa09b338df70d36cc0ac1 # Parent 0541d0d722dfda7d2ceba53aa4111596effb8115 Add minValue, maxValue diff -r 0541d0d722df -r ac3dd9a9d924 src/may/matrix.yeti --- a/src/may/matrix.yeti Wed Oct 30 10:20:34 2013 +0000 +++ b/src/may/matrix.yeti Thu Oct 31 18:25:11 2013 +0000 @@ -759,6 +759,20 @@ fi fi); +minValue m = + if empty?' m then 0 + else + minv ll = fold min (head ll) (tail ll); + minv (map (.v) (enumerate m)); + fi; + +maxValue m = + if empty?' m then 0 + else + maxv ll = fold max (head ll) (tail ll); + maxv (map (.v) (enumerate m)); + fi; + //!!! todo: look at all occurrences of matrix (and complexmatrix) // construction and make sure we have good apis for those use cases. // in particular, constructing from literal data (list>) @@ -793,6 +807,8 @@ toDense, scaled, resizedTo, + minValue, + maxValue, asRows, asColumns, sum = sum', @@ -845,6 +861,8 @@ toDense is matrix -> matrix, scaled is number -> matrix -> matrix, resizedTo is { .rows is number, .columns is number } -> matrix -> matrix, + minValue is matrix -> number, + maxValue is matrix -> number, asRows is matrix -> list, asColumns is matrix -> list, sum is matrix -> matrix -> matrix,