synaps/mpol/binomial.h

00001 /*********************************************************************
00002 *      This file is part of the source code of SYNAPS kernel.        *
00003 *   Author(s): B. Mourrain, GALAAD, INRIA                            *
00004 **********************************************************************/
00005 #ifndef SYNAPS_MPOL_Binomial_H
00006 #define SYNAPS_MPOL_Binomial_H
00007 #include <synaps/init.h>
00008 #include <synaps/arithm/pow.h>
00009 #include <synaps/arithm/binomial.h>
00010 //====================================================================
00011 __BEGIN_NAMESPACE_SYNAPS
00012 //====================================================================
00017 template < class MP >
00018 MP binomial( typename MP::coeff_t coeff, int i, int d, typename MP::coeff_t a)
00019 {
00020   MP polynom;
00021   typename MP::coeff_t tmp;
00022   for ( int k = 0 ; k <= d ; k++ )
00023     {
00024       tmp =  coeff * binomial<typename MP::coeff_t>(d, k) * pow(a,d-k);
00025       polynom += MP( typename MP::monom_t( tmp , i, k ) );
00026     }
00027   return polynom;
00028 }
00029 //====================================================================
00030 __END_NAMESPACE_SYNAPS
00031 //====================================================================
00032 #endif // SYNAPS_MPOL_Binomial_H
00033 
00034 

SYNAPS DOCUMENTATION
logo