# HG changeset patch # User Chris Cannam # Date 1368367000 -3600 # Node ID 1b02d903aa799ac8c3b509205a9fac94478d6936 # Parent 055a0a5500d75fc5aa6e1eed4bc01bd680e496d8 This should be quicker diff -r 055a0a5500d7 -r 1b02d903aa79 yetilab/matrix/matrix.yeti --- a/yetilab/matrix/matrix.yeti Sun May 12 14:50:35 2013 +0100 +++ b/yetilab/matrix/matrix.yeti Sun May 12 14:56:40 2013 +0100 @@ -122,23 +122,27 @@ toColumnMajor m = if not isRowMajor? m then m else flipped m fi; -// Compare matrices using the given comparator for individual cells. -// Note that matrices with different storage order but the same -// contents are equal, although comparing them is slow. -equalUnder comparator m1 m2 = +equal' vecComparator m1 m2 = if size m1 != size m2 then false elif isRowMajor? m1 != isRowMajor? m2 then - equalUnder comparator (flipped m1) m2; + equal' vecComparator (flipped m1) m2; else - compare d1 d2 = all id (map2 (vec.equalUnder comparator) d1 d2); + compare d1 d2 = all id (map2 vecComparator d1 d2); case m1 of RowM d1: case m2 of RowM d2: compare d1 d2; _: false; esac; ColM d1: case m2 of ColM d2: compare d1 d2; _: false; esac; esac fi; -equal = equalUnder (==); +// Compare matrices using the given comparator for individual cells. +// Note that matrices with different storage order but the same +// contents are equal, although comparing them is slow. +equalUnder comparator = + equal' (vec.equalUnder comparator); + +equal = + equal' vec.equal; /*!!! not needed now it's immutable? copyOf m =