/** * Process the index-ieme line/column (direction) on a region. */ void compute_line_or_column_at_index(Matrix* matrix_src, Matrix* matrix_dst, int direction, int index, Region * region) { // Cells required for Taylor formula float aim, adj1, adj2; int variant2 = (direction == VERTICAL) ? region->y : region->x; // For each cell of the line/column for (int mutant = variant2; mutant < (variant2 + region->width); mutant++) { if (direction == VERTICAL) { // COLUMN // Previous aimed cell value aim = MCELL(matrix_src, index, mutant); // Neighbors values adj1 = (mutant >= 1) ? MCELL(matrix_src, index, (mutant-1)) : TEMP_COLD; adj2 = (mutant < matrix_dst->size-1) ? MCELL(matrix_src, index, (mutant+1)) : TEMP_COLD; // Computes the new value MCELL(matrix_dst, index, mutant) = apply_taylor(aim, adj1, adj2); } else if (direction == HORIZONTAL) { // LINE // Previous aimed cell value aim = MCELL(matrix_src, mutant, index); // Neighbors values adj1 = (mutant >= 1) ? MCELL(matrix_src, (mutant-1), index) : TEMP_COLD; adj2 = (mutant < matrix_dst->size-1) ? MCELL(matrix_src, (mutant+1), index) : TEMP_COLD; // Computes the new value MCELL(matrix_dst, mutant, index) = apply_taylor(aim, adj1, adj2); } } }
Word QepcadCls::INITPCAD() { Word D, tv; Step0: /* Determine truth value! */ if (GVNA == FALSE || GVNA != NIL && LELTI(GVNA,1) == NEOP && LELTI(GVNA,2) == 0) tv = NA; else if (LELTI(GVNQFF,1) == NEOP && LELTI(GVNQFF,2) == 0) tv = FALSE; else if (LELTI(GVNQFF,1) == EQOP && LELTI(GVNQFF,2) == 0) tv = TRUE; else tv = UNDET; Step1: /* Make one and initialize it. */ D = MCELL(0,NIL,FALSE,tv,LIST3(0,LIST2(0,0),NIL),NIL,NIL,0,NIL,NIL); Return: /* Prepare for return. */ return(D); }
void EC1(Word c, Word L, Word Bs) { Word B,I,J,Lp,M,N,S,Sp,P,a,b,kp,l,r,rp,s,xb,xp,Lp1,OL; /* hide kp,xp; */ Word T; Step1: /* Initialize. */ S = NIL; Lp = L; kp = 1; xp = 0; M = PMON(1,1); J = LIST2(0,0); Step2: /* No real root. */ if (Lp != NIL) goto Step3; a = CSSP(NIL,NIL); b = LIST1(a); s = LIST3(M,J,b); xp = xp + 1; xb = LIST1(xp); P = LIST1(0); Sp = MCELL(kp,NIL,FALSE,LELTI(c,TRUTH),s,xb,P,LELTI(c,HOWTV),NIL,NIL); S = COMP(Sp,S); SLELTI(c,CHILD,S); goto Return; Step3: /* First sector. */ ADV(Lp,&Lp1,&Lp); FIRST3(Lp1,&B,&I,&OL); FIRST2(I,&l,&r); a = AFFRN(CSSP(NIL,l)); T = r; b = LIST1(a); s = LIST3(M,J,b); xp = xp + 1; xb = LIST1(xp); P = LIST1(0); Sp = MCELL(kp,NIL,FALSE,LELTI(c,TRUTH),s,xb,P,LELTI(c,HOWTV),NIL,NIL); S = COMP(Sp,S); Step4: /* First section. */ if (PDEG(B) == 1) { a = IUPRLP(B); a = AFFRN(a); b = LIST1(a); s = LIST3(M,J,b); } else { a = AFGEN(); b = LIST1(a); s = LIST3(B,I,b); } xp = xp + 1; xb = LIST1(xp); P = LIST1(0); N = NIL; for(Word X = OL; X != NIL; X = RED(X)) { N = COMP(LIST2(THIRD(LELTI(FIRST(X),PO_LABEL)),1),N); } Sp = MCELL(kp,NIL,FALSE,LELTI(c,TRUTH),s,xb,P,LELTI(c,HOWTV),NIL,N); S = COMP(Sp,S); Step5: /* Check if there are more roots. */ if (Lp == NIL) goto Step9; rp = r; Step6: /* Next sector. */ ADV(Lp,&Lp1,&Lp); FIRST3(Lp1,&B,&I,&OL); FIRST2(I,&l,&r); a = AFFRN(CSSP(T,l)); T = r; b = LIST1(a); s = LIST3(M,J,b); xp = xp + 1; xb = LIST1(xp); P = LIST1(0); Sp = MCELL(kp,NIL,FALSE,LELTI(c,TRUTH),s,xb,P,LELTI(c,HOWTV),NIL,NIL); S = COMP(Sp,S); Step7: /* Next section. */ if (PDEG(B) == 1) { a = IUPRLP(B); a = AFFRN(a); b = LIST1(a); s = LIST3(M,J,b); } else { a = AFGEN(); b = LIST1(a); s = LIST3(B,I,b); } xp = xp + 1; xb = LIST1(xp); P = LIST1(0); N = NIL; for(Word X = OL; X != NIL; X = RED(X)) { N = COMP(LIST2(THIRD(LELTI(FIRST(X),PO_LABEL)),1),N); } Sp = MCELL(kp,NIL,FALSE,LELTI(c,TRUTH),s,xb,P,LELTI(c,HOWTV),NIL,N); S = COMP(Sp,S); Step8: /* Loop. */ goto Step5; Step9: /* Last sector. */ a = AFFRN(CSSP(T,NIL)); b = LIST1(a); s = LIST3(M,J,b); xp = xp + 1; xb = LIST1(xp); P = LIST1(0); Sp = MCELL(kp,NIL,FALSE,LELTI(c,TRUTH),s,xb,P,LELTI(c,HOWTV),NIL,NIL); S = COMP(Sp,S); Step10: /* Finalize. */ S = INV(S); SLELTI(c,CHILD,S); goto Return; Return: /* Prepare for return. */ return; }