public static void idx_eloop1 <T>(idx <T> src0, Action <idxlooper <T>, idx <T> > act) where T : struct { idxlooper <T> dst0 = new idxlooper <T>(src0, src0.order() - 1); for (; dst0.notdone(); dst0.next()) { act.Invoke(dst0, src0); } }
public static void idx_eloop2 <T, T2>(idx <T> src0, idx <T2> src1, Action <idxlooper <T>, idx <T>, idxlooper <T2>, idx <T2> > act) where T : struct where T2 : struct { idxlooper <T> dst0 = new idxlooper <T>(src0, src0.order() - 1); idxlooper <T2> dst1 = new idxlooper <T2>(src1, src1.order() - 1); for (; dst0.notdone(); dst0.next(), dst1.next()) { act.Invoke(dst0, src0, dst1, src1); } }
public static void idx_cloop3 <T, T2, T3>(idx <T> src0, idx <T2> src1, idx <T3> src2, Action <idxlooper <T>, idxlooper <T2>, idxlooper <T3> > act) where T : struct where T2 : struct where T3 : struct { idxlooper <T> dst0 = new idxlooper <T>(src0, 0); idxlooper <T2> dst1 = new idxlooper <T2>(src1, 0); idxlooper <T3> dst2 = new idxlooper <T3>(src2, 0); for (; dst0.notdone(); dst0.next(), dst1.next(), dst2.next()) { act.Invoke(dst0, dst1, dst2); } }
public static void Testidxlooper() { idx <Double> ii = new idx <Double>(30, 3); int indx = 5; loops.idx_aloop1_on <double>(new idxiter <double>(), ii, (x) => x.item += indx++); idxlooper <double> lop = new idxlooper <double>(ii, 0); for (; lop.notdone(); lop.next()) { //Global.Print(indx++); Global.Print(lop.idx_ptr().item); } }