@@ -1199,60 +1199,22 @@ private static void validateCol(int size, int col) {
11991199 //--------------------------------------------------------------------------
12001200 // columns
12011201
1202- /**
1203- * An iterator of the columns of the array.
1204- * <pre class="groovyTestCase">
1205- * double[][] nums = [[1.0d, 2.0d], [10.0d, 20.0d]]
1206- * assert nums.transpose() == nums.columns().toList()
1207- * </pre>
1208- *
1209- * @param self a double[][]
1210- * @return the iterator
1211- */
1202+ @ Deprecated
12121203 public static Iterator <double []> columns (double [][] self ) {
12131204 return new DoubleDoubleArrayColumnIterator (self );
12141205 }
12151206
1216- /**
1217- * An iterator of the columns of the array.
1218- * <pre class="groovyTestCase">
1219- * float[][] nums = [[1.0f, 2.0f], [10.0f, 20.0f]]
1220- * assert nums.transpose() == nums.columns().toList()
1221- * </pre>
1222- *
1223- * @param self a float[][]
1224- * @return the iterator
1225- */
1207+ @ Deprecated
12261208 public static Iterator <float []> columns (float [][] self ) {
12271209 return new FloatFloatArrayColumnIterator (self );
12281210 }
12291211
1230- /**
1231- * An iterator of the columns of the array.
1232- * <pre class="groovyTestCase">
1233- * int[][] nums = [[1, 2], [10, 20]]
1234- * assert nums.transpose() == nums.columns().toList()
1235- * assert nums.columns().collect{ int[] col -> col.sum() } == [11, 22]
1236- * </pre>
1237- *
1238- * @param self an int[][]
1239- * @return the iterator
1240- */
1212+ @ Deprecated
12411213 public static Iterator <int []> columns (int [][] self ) {
12421214 return new IntIntArrayColumnIterator (self );
12431215 }
12441216
1245- /**
1246- * An iterator of the columns of the array.
1247- * <pre class="groovyTestCase">
1248- * long[][] nums = [[1L, 2L], [10L, 20L]]
1249- * assert nums.transpose() == nums.columns().toList()
1250- * assert nums.columns().collect{ long[] col -> col.sum() } == [11L, 22L]
1251- * </pre>
1252- *
1253- * @param self a long[][]
1254- * @return the iterator
1255- */
1217+ @ Deprecated
12561218 public static Iterator <long []> columns (long [][] self ) {
12571219 return new LongLongArrayColumnIterator (self );
12581220 }
@@ -9319,6 +9281,67 @@ public static double[][] transpose(double[][] self) {
93199281 return result ;
93209282 }
93219283
9284+ //--------------------------------------------------------------------------
9285+ // transposing
9286+
9287+ /**
9288+ * An iterator of the columns of the array.
9289+ * <pre class="groovyTestCase">
9290+ * double[][] nums = [[1.0d, 2.0d], [10.0d, 20.0d]]
9291+ * assert nums.transpose() == nums.transposing().toList()
9292+ * </pre>
9293+ *
9294+ * @param self a double[][]
9295+ * @return the iterator
9296+ */
9297+ public static Iterator <double []> transposing (double [][] self ) {
9298+ return new DoubleDoubleArrayColumnIterator (self );
9299+ }
9300+
9301+ /**
9302+ * An iterator of the columns of the array.
9303+ * <pre class="groovyTestCase">
9304+ * float[][] nums = [[1.0f, 2.0f], [10.0f, 20.0f]]
9305+ * assert nums.transpose() == nums.transposing().toList()
9306+ * </pre>
9307+ *
9308+ * @param self a float[][]
9309+ * @return the iterator
9310+ */
9311+ public static Iterator <float []> transposing (float [][] self ) {
9312+ return new FloatFloatArrayColumnIterator (self );
9313+ }
9314+
9315+ /**
9316+ * An iterator of the columns of the array.
9317+ * <pre class="groovyTestCase">
9318+ * int[][] nums = [[1, 2], [10, 20]]
9319+ * assert nums.transpose() == nums.transposing().toList()
9320+ * assert nums.transposing().collect{ int[] col -> col.sum() } == [11, 22]
9321+ * </pre>
9322+ *
9323+ * @param self an int[][]
9324+ * @return the iterator
9325+ */
9326+ public static Iterator <int []> transposing (int [][] self ) {
9327+ return new IntIntArrayColumnIterator (self );
9328+ }
9329+
9330+ /**
9331+ * An iterator of the columns of the array.
9332+ * <pre class="groovyTestCase">
9333+ * long[][] nums = [[1L, 2L], [10L, 20L]]
9334+ * assert nums.transpose() == nums.transposing().toList()
9335+ * assert nums.transposing().collect{ long[] col -> col.sum() } == [11L, 22L]
9336+ * </pre>
9337+ *
9338+ * @param self a long[][]
9339+ * @return the iterator
9340+ */
9341+ public static Iterator <long []> transposing (long [][] self ) {
9342+ return new LongLongArrayColumnIterator (self );
9343+ }
9344+
93229345 //--------------------------------------------------------------------------
93239346 // union
93249347
@@ -9640,68 +9663,134 @@ public static List<Tuple2<Double, Integer>> withIndex(double[] self, int offset)
96409663 // zip
96419664
96429665 /**
9643- * An iterator of all the pairs of two arrays.
9666+ * A list of all the pairs from two arrays.
9667+ * <pre class="groovyTestCase">
9668+ * double[] small = [1.0d, 2.0d, 3.0d]
9669+ * double[] large = [100d, 200d, 300d]
9670+ * assert [small, large].transpose() == small.zip(large)
9671+ * </pre>
9672+ *
9673+ * @param self a double[]
9674+ * @param other another double[]
9675+ * @return a list of all the pairs from self and other
9676+ */
9677+ public static List <Tuple2 <Double , Double >> zip (double [] self , double [] other ) {
9678+ return DefaultGroovyMethods .zip (new DoubleArrayIterable (self ), new DoubleArrayIterable (other ));
9679+ }
9680+
9681+ /**
9682+ * An iterator of all the pairs from two arrays.
96449683 * <pre class="groovyTestCase">
96459684 * double[] small = [1.0d, 2.0d, 3.0d]
96469685 * double[] large = [100d, 200d, 300d]
9647- * assert [small, large].transpose() == small.zip (large).toList()
9686+ * assert [small, large].transpose() == small.zipping (large).toList()
96489687 * </pre>
96499688 *
96509689 * @param self a double[]
96519690 * @param other another double[]
96529691 * @return an iterator of all the pairs from self and other
96539692 */
9654- public static Iterator <Tuple2 <Double , Double >> zip (double [] self , double [] other ) {
9693+ public static Iterator <Tuple2 <Double , Double >> zipping (double [] self , double [] other ) {
96559694 return DefaultGroovyMethods .zip (new DoubleArrayIterator (self ), new DoubleArrayIterator (other ));
96569695 }
96579696
96589697 /**
9659- * An iterator of all the pairs of two arrays.
9698+ * A list of all the pairs from two arrays.
96609699 * <pre class="groovyTestCase">
96619700 * float[] small = [1.0f, 2.0f, 3.0f]
96629701 * float[] large = [100f, 200f, 300f]
9663- * assert [small, large].transpose() == small.zip(large).toList()
9702+ * assert [small, large].transpose() == small.zip(large)
9703+ * </pre>
9704+ *
9705+ * @param self a float[]
9706+ * @param other another float[]
9707+ * @return a list of all the pairs from self and other
9708+ */
9709+ public static List <Tuple2 <Float , Float >> zip (float [] self , float [] other ) {
9710+ return DefaultGroovyMethods .zip (new FloatArrayIterable (self ), new FloatArrayIterable (other ));
9711+ }
9712+
9713+ /**
9714+ * An iterator of all the pairs from two arrays.
9715+ * <pre class="groovyTestCase">
9716+ * float[] small = [1.0f, 2.0f, 3.0f]
9717+ * float[] large = [100f, 200f, 300f]
9718+ * assert [small, large].transpose() == small.zipping(large).toList()
96649719 * </pre>
96659720 *
96669721 * @param self a float[]
96679722 * @param other another float[]
96689723 * @return an iterator of all the pairs from self and other
96699724 */
9670- public static Iterator <Tuple2 <Float , Float >> zip (float [] self , float [] other ) {
9725+ public static Iterator <Tuple2 <Float , Float >> zipping (float [] self , float [] other ) {
96719726 return DefaultGroovyMethods .zip (new FloatArrayIterator (self ), new FloatArrayIterator (other ));
96729727 }
96739728
96749729 /**
9675- * An iterator of all the pairs of two arrays.
9730+ * A list of all the pairs from two arrays.
96769731 * <pre class="groovyTestCase">
96779732 * int[] small = [1, 2, 3]
96789733 * int[] large = [100, 200, 300]
96799734 * assert [101, 202, 303] == small.zip(large).collect{ a, b -> a + b }
9680- * assert [small, large].transpose() == small.zip(large).toList()
9735+ * assert [small, large].transpose() == small.zip(large)
9736+ * </pre>
9737+ *
9738+ * @param self an int[]
9739+ * @param other another int[]
9740+ * @return a list of all the pairs from self and other
9741+ */
9742+ public static List <Tuple2 <Integer , Integer >> zip (int [] self , int [] other ) {
9743+ return DefaultGroovyMethods .zip (new IntArrayIterable (self ), new IntArrayIterable (other ));
9744+ }
9745+
9746+ /**
9747+ * An iterator of all the pairs from two arrays.
9748+ * <pre class="groovyTestCase">
9749+ * int[] small = [1, 2, 3]
9750+ * int[] large = [100, 200, 300]
9751+ * assert [101, 202, 303] == small.zipping(large).collect{ a, b -> a + b }
9752+ * assert [small, large].transpose() == small.zipping(large).toList()
96819753 * </pre>
96829754 *
96839755 * @param self an int[]
96849756 * @param other another int[]
96859757 * @return an iterator of all the pairs from self and other
96869758 */
9687- public static Iterator <Tuple2 <Integer , Integer >> zip (int [] self , int [] other ) {
9759+ public static Iterator <Tuple2 <Integer , Integer >> zipping (int [] self , int [] other ) {
96889760 return DefaultGroovyMethods .zip (new IntArrayIterator (self ), new IntArrayIterator (other ));
96899761 }
96909762
96919763 /**
9692- * An iterator of all the pairs of two arrays.
9764+ * A list of all the pairs from two arrays.
96939765 * <pre class="groovyTestCase">
96949766 * long[] small = [1L, 2L, 3L]
96959767 * long[] large = [100L, 200L, 300L]
96969768 * assert [101L, 202L, 303L] == small.zip(large).collect{ a, b -> a + b }
9697- * assert [small, large].transpose() == small.zip(large).toList()
9769+ * assert [small, large].transpose() == small.zip(large)
9770+ * </pre>
9771+ *
9772+ * @param self a long[]
9773+ * @param other another long[]
9774+ * @return a list of all the pairs from self and other
9775+ */
9776+ public static List <Tuple2 <Long , Long >> zip (long [] self , long [] other ) {
9777+ return DefaultGroovyMethods .zip (new LongArrayIterable (self ), new LongArrayIterable (other ));
9778+ }
9779+
9780+ /**
9781+ * An iterator of all the pairs from two arrays.
9782+ * <pre class="groovyTestCase">
9783+ * long[] small = [1L, 2L, 3L]
9784+ * long[] large = [100L, 200L, 300L]
9785+ * assert [101L, 202L, 303L] == small.zipping(large).collect{ a, b -> a + b }
9786+ * assert [small, large].transpose() == small.zipping(large).toList()
96989787 * </pre>
96999788 *
97009789 * @param self a long[]
97019790 * @param other another long[]
97029791 * @return an iterator of all the pairs from self and other
97039792 */
9704- public static Iterator <Tuple2 <Long , Long >> zip (long [] self , long [] other ) {
9793+ public static Iterator <Tuple2 <Long , Long >> zipping (long [] self , long [] other ) {
97059794 return DefaultGroovyMethods .zip (new LongArrayIterator (self ), new LongArrayIterator (other ));
97069795 }
97079796
0 commit comments