Ejemplo n.º 1
0
void numSolverSH::reset(){
    time_t start, endt;
    time(&start);
    
	u=T;
    compPow(l, T);
    
    time(&endt);
    cerr << "time for reset:" << difftime(endt, start) << endl << endl;
    
	//cerr << "finish reset" << endl;
    
    
}
Ejemplo n.º 2
0
void numSolverSH::stepVect(){
    //cerr << "step vect u:" << u << "->" << u-1 << "(";
	u--;
	if(is_previous){ is_previous=false;}
	else {
        if(u==0){
            previous_vect = current_vect;
            current_vect = *finalVector;
        }else if(u>0){
            int kp = (int)log2((u^(u+1))+1);
            //cerr << "u: " << u<< ": kp: " << kp << endl;
            compPow(kp, u);
        }
    }
	
	//cerr << ")" << endl;
}
Ejemplo n.º 3
0
void compPow (complex_t *rop, complex_t op1, int op2) {
	if (op2 == 0) {
		rop->real = 1.0;
		rop->imag = 0.0;
	} else if (op2 < 0) {
		rop->real = 1.0;
		rop->imag = 0.0;
		complex_t aux;
		compPow (&aux, op1, -op2);
		compDiv (rop, *rop, aux);
	} else {
		int i;
		rop->real = op1.real;
		rop->imag = op1.imag;
		for (i=1; i<op2; i++)
			compMul (rop, *rop, op1);
	}
		
}