Project

General

Profile

Feature #1022

New "LF" function which is based on StdDeg

Added by John Abbott about 7 years ago. Updated about 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
New Function
Target version:
Start date:
06 Mar 2017
Due date:
% Done:

20%

Estimated time:
3.00 h
Spent time:

Description

[2017-03-06] Bruns requested by email to have a function like LF which works with respect to the standard grading (even in an ungraded ring, such as one with lex ordering).


Related issues

Related to CoCoALib - Slug #1042: LF curiously slow (breaking a poly into homog pieces)Closed2017-04-10

Related to CoCoA-5 - Feature #1439: New function: LinearFormClosed2020-03-07

History

#1 Updated by John Abbott about 7 years ago

CoCoALib currently offers deg (or equiv. StdDeg) and wdeg. These functions throw an exception if the ring has grading dim zero (i.e. ungraded).
Bruns would like to have a new function which determines the "leading form with respect to the standard grading" regardless of any grading which the ring has.

He also pointed out that to be consistent we should actually call the current LF function wLF (akin to wdeg).

I noticed that in one of his messages he actually wanted a decomposition of a polynomial into homogeneous pieces; should we consider adding such a function?

#2 Updated by Winfried Bruns about 7 years ago

Why not have a function for decomposing a polynomial into its homogeneous components? There is one in NmzIntegrate.

#3 Updated by Anna Maria Bigatti about 7 years ago

Here is the function.
I'm still uncertain whether this should be part of cocoalib or not.
Anyway it may be copied and used :-)

  RingElem LF_StdDeg(ConstRefRingElem f)
  {
    if (!IsPolyRing(owner(f)))
      CoCoA_ERROR(ERR::NotElemPolyRing, "LF_StdDeg(f)");
    const SparsePolyRing P = owner(f);
    if (IsZero(f)) CoCoA_ERROR(ERR::ZeroRingElem, "LF_StdDeg(f)");
    RingElem F(P);
    long MaxDeg = 0;
    for (SparsePolyIter it=BeginIter(f) ; !IsEnded(it) ; ++it )
    {
      long d = deg(PP(it));
      if (d > MaxDeg)
      {
        MaxDeg = d;
        F = monomial(P, coeff(it), PP(it));
      }
      else if (d == MaxDeg)
        F += monomial(P, coeff(it), PP(it));
    }
    return F;
  }

#4 Updated by Anna Maria Bigatti about 7 years ago

  • % Done changed from 0 to 20
  • Estimated time set to 3.00 h

Winfried Bruns wrote:

Why not have a function for decomposing a polynomial into its homogeneous components? There is one in NmzIntegrate.

I'm reluctant about that. We usually follow the rule not to make easy functions for things which might be pointlessly expensive in their application.
deg is quite expensive in cocoalib.
moreover it would duplicate piece by piece the whole polynomial (from what I see in you particular example you need only the highest degree part)

That's why we have a SparsePolyIter which is so cheap and nice to use ;-)

#5 Updated by John Abbott about 7 years ago

  • Related to Slug #1042: LF curiously slow (breaking a poly into homog pieces) added

#6 Updated by Anna Maria Bigatti about 4 years ago

Also available in: Atom PDF