Changeset 47a4c2 in git for Singular/ipshell.cc


Ignore:
Timestamp:
Aug 3, 2011, 8:20:19 PM (13 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
2c52441d528d3c9973ac9373c0325fe522bab68e
Parents:
d16ea9b1d0fce4837d7154d0bdcaa13889e507bc
git-author:
Martin Lee <martinlee84@web.de>2011-08-03 20:20:19+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:14:23+01:00
Message:
moved  semicState,spectrumState and spectrumPrintError to ipshell.cc
adapted member functions involving lists from semic and splist in ipshell.cc
moved function declarations from spectrum.h involving leftv to ipshell.h
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/ipshell.cc

    rd16ea9 r47a4c2  
    27952795
    27962796// ----------------------------------------------------------------------------
    2797 //  Initialize a  spectrum  deep from another  spectrum
    2798 // ----------------------------------------------------------------------------
    2799 
    2800 void spectrum::copy_deep( const spectrum &spec )
    2801 {
    2802     mu = spec.mu;
    2803     pg = spec.pg;
    2804     n  = spec.n;
    2805 
    2806     copy_new( n );
    2807 
    2808     for( int i=0; i<n; i++ )
    2809     {
    2810         s[i] = spec.s[i];
    2811         w[i] = spec.w[i];
    2812     }
    2813 }
    2814 
    2815 // ----------------------------------------------------------------------------
    28162797//  Initialize a  spectrum  deep from a  singular  lists
    28172798// ----------------------------------------------------------------------------
    28182799
    2819 void spectrum::copy_deep( lists l )
    2820 {
    2821     mu = (int)(long)(l->m[0].Data( ));
    2822     pg = (int)(long)(l->m[1].Data( ));
    2823     n  = (int)(long)(l->m[2].Data( ));
    2824 
    2825     copy_new( n );
     2800void copy_deep( spectrum& spec, lists l )
     2801{
     2802    spec.mu = (int)(long)(l->m[0].Data( ));
     2803    spec.pg = (int)(long)(l->m[1].Data( ));
     2804    spec.n  = (int)(long)(l->m[2].Data( ));
     2805
     2806    spec.copy_new( spec.n );
    28262807
    28272808    intvec  *num = (intvec*)l->m[3].Data( );
     
    28292810    intvec  *mul = (intvec*)l->m[5].Data( );
    28302811
    2831     for( int i=0; i<n; i++ )
    2832     {
    2833         s[i] = (Rational)((*num)[i])/(Rational)((*den)[i]);
    2834         w[i] = (*mul)[i];
     2812    for( int i=0; i<spec.n; i++ )
     2813    {
     2814        spec.s[i] = (Rational)((*num)[i])/(Rational)((*den)[i]);
     2815        spec.w[i] = (*mul)[i];
    28352816    }
    28362817}
     
    28402821// ----------------------------------------------------------------------------
    28412822
    2842 spectrum::spectrum( lists l )
    2843 {
    2844     copy_deep( l );
     2823spectrum /*former spectrum::spectrum ( lists l )*/
     2824spectrumFromList( lists l )
     2825{
     2826    spectrum result;
     2827    copy_deep( result, l );
     2828    return result;
    28452829}
    28462830
     
    28492833// ----------------------------------------------------------------------------
    28502834
    2851 lists   spectrum::thelist( void )
     2835/* former spectrum::thelist ( void )*/
     2836lists   getList( spectrum& spec )
    28522837{
    28532838    lists   L  = (lists)omAllocBin( slists_bin);
     
    28552840    L->Init( 6 );
    28562841
    2857     intvec            *num  = new intvec( n );
    2858     intvec            *den  = new intvec( n );
    2859     intvec            *mult = new intvec( n );
    2860 
    2861     for( int i=0; i<n; i++ )
    2862     {
    2863         (*num) [i] = s[i].get_num_si( );
    2864         (*den) [i] = s[i].get_den_si( );
    2865         (*mult)[i] = w[i];
     2842    intvec            *num  = new intvec( spec.n );
     2843    intvec            *den  = new intvec( spec.n );
     2844    intvec            *mult = new intvec( spec.n );
     2845
     2846    for( int i=0; i<spec.n; i++ )
     2847    {
     2848        (*num) [i] = spec.s[i].get_num_si( );
     2849        (*den) [i] = spec.s[i].get_den_si( );
     2850        (*mult)[i] = spec.w[i];
    28662851    }
    28672852
     
    28732858    L->m[5].rtyp = INTVEC_CMD; //  multiplicities
    28742859
    2875     L->m[0].data = (void*)mu;
    2876     L->m[1].data = (void*)pg;
    2877     L->m[2].data = (void*)n;
     2860    L->m[0].data = (void*)spec.mu;
     2861    L->m[1].data = (void*)spec.pg;
     2862    L->m[2].data = (void*)spec.n;
    28782863    L->m[3].data = (void*)num;
    28792864    L->m[4].data = (void*)den;
     
    28862871//  print out an error message for a spectrum list
    28872872// ----------------------------------------------------------------------------
     2873
     2874typedef enum
     2875{
     2876    semicOK,
     2877    semicMulNegative,
     2878
     2879    semicListTooShort,
     2880    semicListTooLong,
     2881
     2882    semicListFirstElementWrongType,
     2883    semicListSecondElementWrongType,
     2884    semicListThirdElementWrongType,
     2885    semicListFourthElementWrongType,
     2886    semicListFifthElementWrongType,
     2887    semicListSixthElementWrongType,
     2888
     2889    semicListNNegative,
     2890    semicListWrongNumberOfNumerators,
     2891    semicListWrongNumberOfDenominators,
     2892    semicListWrongNumberOfMultiplicities,
     2893
     2894    semicListMuNegative,
     2895    semicListPgNegative,
     2896    semicListNumNegative,
     2897    semicListDenNegative,
     2898    semicListMulNegative,
     2899
     2900    semicListNotSymmetric,
     2901    semicListNotMonotonous,
     2902
     2903    semicListMilnorWrong,
     2904    semicListPGWrong
     2905
     2906} semicState;
    28882907
    28892908void    list_error( semicState state )
     
    29692988// ----------------------------------------------------------------------------
    29702989
     2990enum    spectrumState
     2991{
     2992    spectrumOK,
     2993    spectrumZero,
     2994    spectrumBadPoly,
     2995    spectrumNoSingularity,
     2996    spectrumNotIsolated,
     2997    spectrumDegenerate,
     2998    spectrumWrongRing,
     2999    spectrumNoHC,
     3000    spectrumUnspecErr
     3001};
     3002
    29713003spectrumState   spectrumCompute( poly h,lists *L,int fast )
    29723004{
     
    31793211  #endif
    31803212
    3181   newtonPolygon nph( h );
     3213  newtonPolygon nph( h, currRing );
    31823214
    31833215  #ifdef SPECTRUM_DEBUG
     
    32583290//  result = list of spectrum numbers
    32593291// ----------------------------------------------------------------------------
     3292
     3293void spectrumPrintError(spectrumState state)
     3294{
     3295  switch( state )
     3296  {
     3297    case spectrumZero:
     3298      WerrorS( "polynomial is zero" );
     3299      break;
     3300    case spectrumBadPoly:
     3301      WerrorS( "polynomial has constant term" );
     3302      break;
     3303    case spectrumNoSingularity:
     3304      WerrorS( "not a singularity" );
     3305      break;
     3306    case spectrumNotIsolated:
     3307      WerrorS( "the singularity is not isolated" );
     3308      break;
     3309    case spectrumNoHC:
     3310      WerrorS( "highest corner cannot be computed" );
     3311      break;
     3312    case spectrumDegenerate:
     3313      WerrorS( "principal part is degenerate" );
     3314      break;
     3315    case spectrumOK:
     3316      break;
     3317
     3318    default:
     3319      WerrorS( "unknown error occurred" );
     3320      break;
     3321  }
     3322}
    32603323
    32613324BOOLEAN spectrumProc( leftv result,leftv first )
     
    35773640    else
    35783641    {
    3579         spectrum s1( l1 );
    3580         spectrum s2( l2 );
     3642        spectrum s1= spectrumFromList ( l1 );
     3643        spectrum s2= spectrumFromList ( l2 );
    35813644        spectrum sum( s1+s2 );
    35823645
    35833646        result->rtyp = LIST_CMD;
    3584         result->data = (char*)(sum.thelist( ));
     3647        result->data = (char*)(getList(sum));
    35853648    }
    35863649
     
    36193682    else
    36203683    {
    3621         spectrum s( l );
     3684        spectrum s= spectrumFromList( l );
    36223685        spectrum product( k*s );
    36233686
    36243687        result->rtyp = LIST_CMD;
    3625         result->data = (char*)product.thelist( );
     3688        result->data = (char*)getList(product);
    36263689    }
    36273690
     
    36613724  else
    36623725  {
    3663     spectrum s1( l1 );
    3664     spectrum s2( l2 );
     3726    spectrum s1= spectrumFromList( l1 );
     3727    spectrum s2= spectrumFromList( l2 );
    36653728
    36663729    res->rtyp = INT_CMD;
     
    36913754// ----------------------------------------------------------------------------
    36923755
    3693 spectrumState   spectrumPolyList::spectrum( lists *L,int fast )
    3694 {
    3695     spectrumPolyNode  **node = &root;
     3756/* former spectrumPolyList::spectrum ( lists*, int) */
     3757spectrumState   spectrumStateFromList( spectrumPolyList& speclist, lists *L,int fast )
     3758{
     3759    spectrumPolyNode  **node = &speclist.root;
    36963760    spectrumPolyNode  *search;
    36973761
     
    38183882                search = search->next;
    38193883            }
    3820             delete_node( node );
     3884            speclist.delete_node( node );
    38213885        }
    38223886
     
    38443908    int multiplicity  = 1;
    38453909
    3846     for( search=root; search!=(spectrumPolyNode*)NULL &&
     3910    for( search=speclist.root; search!=(spectrumPolyNode*)NULL &&
    38473911                     ( fast==0 || search->weight<=smax );
    38483912                     search=search->next )
Note: See TracChangeset for help on using the changeset viewer.