@@ -284,6 +284,17 @@ public static ArrayList<ArrayList<Object>> collect_15(Collection<Object> _l,Func
284
284
return _results_15 ;
285
285
}
286
286
287
+ public static ArrayList <ArrayList <Object >> collect_selectElements (Collection <Object > _l ,Function <Double , Boolean > f )
288
+ { // Implements: m->collect( _r | MatrixLib.selectElements(_r->oclAsType(Sequence),f) )
289
+
290
+ ArrayList <ArrayList <Object >> _results_15 = new ArrayList <ArrayList <Object >>();
291
+ for (Object _i : _l )
292
+ { Object _r = (Object ) _i ;
293
+ _results_15 .add (MatrixLib .selectElements (((ArrayList ) _r ),f ));
294
+ }
295
+ return _results_15 ;
296
+ }
297
+
287
298
public static ArrayList <Double > collect_16 (Collection <Object > _l )
288
299
{ // Implements: Sequence{}->collect( object_16_xx | 0.0 )
289
300
ArrayList <Double > _results_16 = new ArrayList <Double >();
@@ -605,26 +616,43 @@ public static double prdMatrix(ArrayList m)
605
616
return MatrixLib .prdMatrix (sq ) * MatrixLib .prdMatrix (Ocl .tail (m ));
606
617
607
618
}
608
- else { }
609
619
610
620
ArrayList <Double > dmat = Ocl .concatenate (Ocl .addSequence ((new ArrayList <Double >()), new Double (1.0 )), m );
611
621
612
622
return Ocl .prddouble (dmat );
623
+ }
613
624
614
625
615
626
627
+ public static ArrayList selectElements (ArrayList m ,Function <Double , Boolean > f )
628
+ { ArrayList result ;
629
+ if ((m ).size () == 0 )
630
+ { return (new ArrayList <Double >()); }
631
+
632
+ if ((((Object ) m .get (1 - 1 )) instanceof ArrayList ))
633
+ { return MatrixLib_Aux .collect_selectElements (m ,f ); }
634
+
635
+ ArrayList <Double > dmat = new ArrayList <Double >();
636
+
637
+ ArrayList <Object > _range7 = new ArrayList <Object >();
638
+ _range7 .addAll (m );
639
+ for (int _i6 = 0 ; _i6 < _range7 .size (); _i6 ++)
640
+ { Object x = (Object ) _range7 .get (_i6 );
641
+ double y = (double ) x ;
642
+ if (f .apply (y ))
643
+ { dmat = Ocl .append (dmat ,y ); }
644
+ }
645
+ return dmat ;
616
646
}
617
647
618
648
619
649
public static ArrayList elementwiseApply (ArrayList m ,Function <Double , Double > f )
620
650
{ ArrayList result ;
621
- if ((m ).size () == 0 )
622
- { return (new ArrayList <Object >()); }
623
- else { }
651
+ if ((m ).size () == 0 )
652
+ { return (new ArrayList <Double >()); }
624
653
625
- if ((((Object ) m .get (1 - 1 )) instanceof ArrayList ))
626
- { return MatrixLib_Aux .collect_15 (m ,f ); }
627
- else { }
654
+ if ((((Object ) m .get (1 - 1 )) instanceof ArrayList ))
655
+ { return MatrixLib_Aux .collect_15 (m ,f ); }
628
656
629
657
ArrayList <Double > dmat = MatrixLib_Aux .collect_16 ((new ArrayList <Object >()));
630
658
@@ -634,27 +662,20 @@ public static ArrayList elementwiseApply(ArrayList m,Function<Double, Double> f)
634
662
{ Object x = (Object ) _range7 .get (_i6 );
635
663
double y = ((double ) x );
636
664
637
- dmat = Ocl .append (dmat ,(f ).apply (y ));
638
-
639
-
640
- }
641
- return dmat ;
642
-
643
-
644
-
645
-
665
+ dmat = Ocl .append (dmat ,(f ).apply (y ));
666
+ }
667
+ return dmat ;
646
668
}
647
669
648
-
649
670
public static ArrayList elementwiseMult (ArrayList m ,double x )
650
671
{ ArrayList result ;
651
672
if ((m ).size () == 0 )
652
673
{ return (new ArrayList <Object >()); }
653
- else { }
674
+
654
675
655
676
if ((((Object ) m .get (1 - 1 )) instanceof ArrayList ))
656
677
{ return MatrixLib_Aux .collect_17 (m ,x ); }
657
- else { }
678
+
658
679
659
680
ArrayList <Double > dmat = MatrixLib_Aux .collect_16 ((new ArrayList <Object >()));
660
681
0 commit comments