@@ -284,6 +284,17 @@ public static ArrayList<ArrayList<Object>> collect_15(Collection<Object> _l,Func
284284 return _results_15 ;
285285 }
286286
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+
287298 public static ArrayList <Double > collect_16 (Collection <Object > _l )
288299 { // Implements: Sequence{}->collect( object_16_xx | 0.0 )
289300 ArrayList <Double > _results_16 = new ArrayList <Double >();
@@ -605,26 +616,43 @@ public static double prdMatrix(ArrayList m)
605616 return MatrixLib .prdMatrix (sq ) * MatrixLib .prdMatrix (Ocl .tail (m ));
606617
607618 }
608- else { }
609619
610620 ArrayList <Double > dmat = Ocl .concatenate (Ocl .addSequence ((new ArrayList <Double >()), new Double (1.0 )), m );
611621
612622 return Ocl .prddouble (dmat );
623+ }
613624
614625
615626
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 ;
616646 }
617647
618648
619649 public static ArrayList elementwiseApply (ArrayList m ,Function <Double , Double > f )
620650 { ArrayList result ;
621- if ((m ).size () == 0 )
622- { return (new ArrayList <Object >()); }
623- else { }
651+ if ((m ).size () == 0 )
652+ { return (new ArrayList <Double >()); }
624653
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 ); }
628656
629657 ArrayList <Double > dmat = MatrixLib_Aux .collect_16 ((new ArrayList <Object >()));
630658
@@ -634,27 +662,20 @@ public static ArrayList elementwiseApply(ArrayList m,Function<Double, Double> f)
634662 { Object x = (Object ) _range7 .get (_i6 );
635663 double y = ((double ) x );
636664
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 ;
646668 }
647669
648-
649670 public static ArrayList elementwiseMult (ArrayList m ,double x )
650671 { ArrayList result ;
651672if ((m ).size () == 0 )
652673{ return (new ArrayList <Object >()); }
653- else { }
674+
654675
655676 if ((((Object ) m .get (1 - 1 )) instanceof ArrayList ))
656677{ return MatrixLib_Aux .collect_17 (m ,x ); }
657- else { }
678+
658679
659680 ArrayList <Double > dmat = MatrixLib_Aux .collect_16 ((new ArrayList <Object >()));
660681
0 commit comments