Esempio n. 1
0
		bool test() {
			Polynomial p = Polynomial();
			p.push(0.0f,0.0f);
			p.push(M_PI/6,0.5f);
			p.push(2*M_PI/6,0.866f);
			p.push(3*M_PI/6,1.0f);
			p.print();
/*			std::cout << "p(-2.0f) = " << p.eval(-2.0f) << std::endl;
			std::cout << "p(0.0f) = " << p.eval(0.0f) << std::endl;
			std::cout << "p(1.0f) = " << p.eval(1.0f) << std::endl;
			std::cout << "p(2.0f) = " << p.eval(2.0f) << std::endl;
			std::cout << "p(4.0f) = " << p.eval(4.0f) << std::endl;*/
			return true;
		}
Esempio n. 2
0
void SpecificCompUniverseNoOrderPos<T>::addBorder()
{
    OwningVector<IPolynomial<T>*>* newElements = new OwningVector<IPolynomial<T>*>();
    for(uint i=0,end_i=U->size();i<end_i;i++) {
        Polynomial<T>* p = new Polynomial<T>(ICompUniverse<T>::indet);
        for(uint k=0,end_k=U->getIndet();k<end_k;k++) {
            IMonomial* m = U->at(i)->getMonomial()->copy();
            m = m->extend(k,1);

            bool excluded = false;
            for(uint i=0;i<ICompUniverse<T>::exclusions->size() && !excluded;i++) {
                excluded |= ICompUniverse<T>::exclusions->at(i)->divides(m);
                excluded |= (ICompUniverse<T>::exclusions->at(i)->compare(m)==0);
            }

            if(!excluded)
                p->push(new Term<T>(1,m));
            else
                m->del();
        }
        newElements->push_back(p);
    }
    ICompUniverse<T>::add(newElements);
    delete newElements;
}