Changeset df83c0 in git for Singular/fglmzero.cc


Ignore:
Timestamp:
Nov 24, 1999, 1:29:38 PM (24 years ago)
Author:
Tim Wichmann <wichmann@…>
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
015eaa982b5452b61c7e2510ba7ecfcfc9606d1a
Parents:
d47e6fd256e2e97a44cc9bae4b289a40732b3e98
Message:
* added fglmquot


git-svn-id: file:///usr/local/Singular/svn/trunk@3905 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/fglmzero.cc

    rd47e6f rdf83c0  
    11// emacs edit mode for this file is -*- C++ -*-
    2 // $Id: fglmzero.cc,v 1.26 1999-11-15 17:20:03 obachman Exp $
     2// $Id: fglmzero.cc,v 1.27 1999-11-24 12:29:37 wichmann Exp $
    33
    44/****************************************
     
    3131#include "maps.h"
    3232#include "mmemory.h"
     33#include "kstd1.h" // for kNF (see fglmquot)
    3334#include "fglm.h"
    3435#include "fglmvec.h"
     
    540541                // This is the place where we can detect if the sourceIdeal
    541542                // is not reduced. In this case m is not in basis[]. Since basis[]
    542                 // is ordered this is then and only then the case, if basis[i]<m
     543                // is ordered this is the case, if and only if basis[i]<m
    543544                // and basis[j]>m for all j>i
    544545                _state= FALSE;
     
    584585}
    585586
    586 //     Calculates the defining Functionals for the ideal "theIdeal" and
    587 //     returns them in "l".
    588 //     The ideal has to be zero-dimensional and reduced and has to be a
    589 //     real subset of the polynomal ring.
    590 //     In any case it has to be zero-dimensional and minimal (check this
    591 //      via fglmIdealcheck). Any minimal but not reduced ideal is detected.
    592 //      In this case it returns FglmNotReduced.
    593 //     If the base domain is Q, the leading coefficients of the polys
    594 //     have to be in Z.
    595 //     returns TRUE if the result is valid, FALSE if theIdeal
    596 //      is not reduced.
    597 static BOOLEAN
    598 CalculateFunctionals( const ideal & theIdeal, idealFunctionals & l )
    599 {
    600     fglmSdata data( theIdeal );
     587void
     588internalCalculateFunctionals( const ideal & theIdeal, idealFunctionals & l,
     589                              fglmSdata & data )
     590{
    601591
    602592    // insert pOne() into basis and update the workingList:
     
    643633    l.endofConstruction();
    644634    STICKYPROT2( "\nvdim= %i\n", data.getBasisSize() );
     635    return;
     636}
     637
     638//     Calculates the defining Functionals for the ideal "theIdeal" and
     639//     returns them in "l".
     640//     The ideal has to be zero-dimensional and reduced and has to be a
     641//     real subset of the polynomal ring.
     642//     In any case it has to be zero-dimensional and minimal (check this
     643//      via fglmIdealcheck). Any minimal but not reduced ideal is detected.
     644//      In this case it returns FglmNotReduced.
     645//     If the base domain is Q, the leading coefficients of the polys
     646//     have to be in Z.
     647//     returns TRUE if the result is valid, FALSE if theIdeal
     648//      is not reduced.
     649static BOOLEAN
     650CalculateFunctionals( const ideal & theIdeal, idealFunctionals & l )
     651{
     652    fglmSdata data( theIdeal );
     653    internalCalculateFunctionals( theIdeal, l, data );
     654    return ( data.state() );
     655}
     656
     657static BOOLEAN
     658CalculateFunctionals( const ideal & theIdeal, idealFunctionals & l,
     659                      poly & p, fglmVector & v )
     660{
     661    fglmSdata data( theIdeal );
     662    internalCalculateFunctionals( theIdeal, l, data );
     663    //    STICKYPROT("Calculating vector rep\n");
     664    v = data.getVectorRep( p );
     665    // if ( v.isZero() )
     666    //   STICKYPROT("vectorrep is 0\n");
    645667    return ( data.state() );
    646668}
     
    765787fglmDdata::~fglmDdata()
    766788{
    767     fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" );
     789  // STICKYPROT2("dimen= %i", dimen);
     790  // STICKYPROT2("basisSize= %i", basisSize);
     791  //    fglmASSERT( dimen == basisSize, "Es wurden nicht alle BasisElemente gefunden!" );
    768792    int k;
    769793#ifndef HAVE_EXPLICIT_CONSTR
    770794    delete [] gauss;
    771795#else
    772     for ( k= dimen; k > 0; k-- )
     796    // use basisSize instead of dimen because of fglmquot!
     797    for ( k= basisSize; k > 0; k-- )
    773798        gauss[k].~oldGaussElem();
    774799    Free( (ADDRESS)gauss, (dimen+1)*sizeof( oldGaussElem ) );
     
    776801    Free( (ADDRESS)isPivot, (dimen+1)*sizeof( BOOLEAN ) );
    777802    Free( (ADDRESS)perm, (dimen+1)*sizeof( int ) );
     803    // use basisSize instead of dimen because of fglmquot!
    778804    //. Remember: There is no poly in basis[0], thus k > 0
    779     for ( k= dimen; k > 0; k-- )
     805    for ( k= basisSize; k > 0; k-- )
    780806        pDelete1( basis + k );
    781807    Free( (ADDRESS)basis, (dimen+1)*sizeof( poly ) );
     
    9751001
    9761002static ideal
    977 GroebnerViaFunctionals( const idealFunctionals & l )
    978 // Calculates the groebnerBasis for the ideal which is defined by l.
     1003GroebnerViaFunctionals( const idealFunctionals & l,
     1004                        fglmVector iv = fglmVector() )
     1005// If iv is zero, calculates the groebnerBasis for the ideal which is
     1006// defined by l.
     1007// If iv is not zero, then the groebnerBasis if i:p is calculated where
     1008// i is defined by l and iv is the vector-representation of nf(p) wrt. i
    9791009// The dimension of l has to be finite.
    9801010// The result is in reduced form.
     
    9821012    fglmDdata data( l.dimen() );
    9831013
    984     // insert pOne() and update workinglist:
     1014    // insert pOne() and update workinglist according to iv:
     1015    fglmVector initv;
     1016    if ( iv.isZero() ) {
     1017      // STICKYPROT("initv is zero\n");
     1018      initv = fglmVector( l.dimen(), 1 );
     1019    }
     1020    else {
     1021      // STICKYPROT("initv is not zero\n");
     1022      initv = iv;
     1023    }
     1024     
    9851025    poly one = pOne();
    986     data.updateCandidates( one, fglmVector(l.dimen(), 1) );
     1026    data.updateCandidates( one, initv );
    9871027    number nOne = nInit( 1 );
    988     data.newBasisElem( one, fglmVector( l.dimen(), 1 ), fglmVector( 1, 1 ), nOne );
     1028    data.newBasisElem( one, initv, fglmVector( 1, 1 ), nOne );
    9891029    STICKYPROT( "." );
    9901030    while ( data.candidatesLeft() == TRUE ) {
     
    11131153
    11141154BOOLEAN
     1155fglmquot( ideal sourceIdeal, poly quot, ideal & destIdeal)
     1156{
     1157    BOOLEAN fglmok;
     1158    fglmVector v;
     1159
     1160    idealFunctionals L( 100, pVariables );
     1161    // STICKYPROT("calculating normal form\n");
     1162    // poly p = kNF( sourceIdeal, currRing->qideal, quot );
     1163    // STICKYPROT("calculating functionals\n");
     1164    fglmok = CalculateFunctionals( sourceIdeal, L, quot, v );
     1165    if ( fglmok == TRUE ) {
     1166      // STICKYPROT("calculating groebner basis\n");
     1167        destIdeal= GroebnerViaFunctionals( L, v );
     1168    }
     1169    return fglmok;
     1170}
     1171
     1172BOOLEAN
    11151173FindUnivariateWrapper( ideal source, ideal & destIdeal )
    11161174{
Note: See TracChangeset for help on using the changeset viewer.