- Timestamp:
- Mar 31, 2022, 2:19:28 PM (2 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 03e31554a5f308d79b80ade9e36dd826ddb61c08
- Parents:
- c808198eb3569c6fecf1ebaacef81b08e8aea4ff
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libpolys/polys/monomials/p_polys.cc
rc808198 rfff1bf 3797 3797 void p_Norm(poly p1, const ring r) 3798 3798 { 3799 if ( rField_is_Ring(r))3799 if (LIKELY(rField_is_Ring(r))) 3800 3800 { 3801 3801 if(!n_GreaterZero(pGetCoeff(p1),r->cf)) p1 = p_Neg(p1,r); … … 3803 3803 // Werror("p_Norm not possible in the case of coefficient rings."); 3804 3804 } 3805 else if ( p1!=NULL)3806 { 3807 if ( pNext(p1)==NULL)3805 else if (LIKELY(p1!=NULL)) 3806 { 3807 if (UNLIKELY(pNext(p1)==NULL)) 3808 3808 { 3809 3809 p_SetCoeff(p1,n_Init(1,r->cf),r); … … 3812 3812 if (!n_IsOne(pGetCoeff(p1),r->cf)) 3813 3813 { 3814 number k, c; 3815 n_Normalize(pGetCoeff(p1),r->cf); 3816 k = pGetCoeff(p1); 3817 c = n_Init(1,r->cf); 3818 pSetCoeff0(p1,c); 3814 number k = pGetCoeff(p1); 3815 pSetCoeff0(p1,n_Init(1,r->cf)); 3819 3816 poly h = pNext(p1); 3820 if ( rField_is_Zp(r))3817 if (LIKELY(rField_is_Zp(r))) 3821 3818 { 3822 3819 if (r->cf->ch>32003) … … 3825 3822 while (h!=NULL) 3826 3823 { 3827 c=n_Mult(pGetCoeff(h),inv,r->cf);3824 number c=n_Mult(pGetCoeff(h),inv,r->cf); 3828 3825 // no need to normalize 3829 3826 p_SetCoeff(h,c,r); … … 3836 3833 while (h!=NULL) 3837 3834 { 3838 c=n_Div(pGetCoeff(h),k,r->cf);3835 number c=n_Div(pGetCoeff(h),k,r->cf); 3839 3836 // no need to normalize 3840 3837 p_SetCoeff(h,c,r); … … 3845 3842 else if(getCoeffType(r->cf)==n_algExt) 3846 3843 { 3844 n_Normalize(k,r->cf); 3847 3845 number inv=n_Invers(k,r->cf); 3848 3846 while (h!=NULL) 3849 3847 { 3850 c=n_Mult(pGetCoeff(h),inv,r->cf);3848 number c=n_Mult(pGetCoeff(h),inv,r->cf); 3851 3849 // no need to normalize 3852 // normalize already in nMult: Zp_a 3850 // normalize already in nMult: Zp_a, Q_a 3853 3851 p_SetCoeff(h,c,r); 3854 3852 pIter(h); 3855 3853 } 3856 3854 n_Delete(&inv,r->cf); 3855 n_Delete(&k,r->cf); 3857 3856 } 3858 3857 else 3859 3858 { 3859 n_Normalize(k,r->cf); 3860 3860 while (h!=NULL) 3861 3861 { 3862 c=n_Div(pGetCoeff(h),k,r->cf);3862 number c=n_Div(pGetCoeff(h),k,r->cf); 3863 3863 // no need to normalize: Z/p, R 3864 // normalize already in nDiv: Q_a3865 3864 // remains: Q 3866 if (rField_is_Q(r) && (!n_IsOne(c,r->cf))) n_Normalize(c,r->cf);3865 if (rField_is_Q(r)) n_Normalize(c,r->cf); 3867 3866 p_SetCoeff(h,c,r); 3868 3867 pIter(h); 3869 3868 } 3870 }3871 n_Delete(&k,r->cf);3869 n_Delete(&k,r->cf); 3870 } 3872 3871 } 3873 3872 else
Note: See TracChangeset
for help on using the changeset viewer.