Changeset 47a4c2 in git
- Timestamp:
- Aug 3, 2011, 8:20:19 PM (12 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- 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
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/ipshell.cc
rd16ea9 r47a4c2 2795 2795 2796 2796 // ---------------------------------------------------------------------------- 2797 // Initialize a spectrum deep from another spectrum2798 // ----------------------------------------------------------------------------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 // ----------------------------------------------------------------------------2816 2797 // Initialize a spectrum deep from a singular lists 2817 2798 // ---------------------------------------------------------------------------- 2818 2799 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 );2800 void 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 ); 2826 2807 2827 2808 intvec *num = (intvec*)l->m[3].Data( ); … … 2829 2810 intvec *mul = (intvec*)l->m[5].Data( ); 2830 2811 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]; 2835 2816 } 2836 2817 } … … 2840 2821 // ---------------------------------------------------------------------------- 2841 2822 2842 spectrum::spectrum( lists l ) 2843 { 2844 copy_deep( l ); 2823 spectrum /*former spectrum::spectrum ( lists l )*/ 2824 spectrumFromList( lists l ) 2825 { 2826 spectrum result; 2827 copy_deep( result, l ); 2828 return result; 2845 2829 } 2846 2830 … … 2849 2833 // ---------------------------------------------------------------------------- 2850 2834 2851 lists spectrum::thelist( void ) 2835 /* former spectrum::thelist ( void )*/ 2836 lists getList( spectrum& spec ) 2852 2837 { 2853 2838 lists L = (lists)omAllocBin( slists_bin); … … 2855 2840 L->Init( 6 ); 2856 2841 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]; 2866 2851 } 2867 2852 … … 2873 2858 L->m[5].rtyp = INTVEC_CMD; // multiplicities 2874 2859 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; 2878 2863 L->m[3].data = (void*)num; 2879 2864 L->m[4].data = (void*)den; … … 2886 2871 // print out an error message for a spectrum list 2887 2872 // ---------------------------------------------------------------------------- 2873 2874 typedef 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; 2888 2907 2889 2908 void list_error( semicState state ) … … 2969 2988 // ---------------------------------------------------------------------------- 2970 2989 2990 enum spectrumState 2991 { 2992 spectrumOK, 2993 spectrumZero, 2994 spectrumBadPoly, 2995 spectrumNoSingularity, 2996 spectrumNotIsolated, 2997 spectrumDegenerate, 2998 spectrumWrongRing, 2999 spectrumNoHC, 3000 spectrumUnspecErr 3001 }; 3002 2971 3003 spectrumState spectrumCompute( poly h,lists *L,int fast ) 2972 3004 { … … 3179 3211 #endif 3180 3212 3181 newtonPolygon nph( h );3213 newtonPolygon nph( h, currRing ); 3182 3214 3183 3215 #ifdef SPECTRUM_DEBUG … … 3258 3290 // result = list of spectrum numbers 3259 3291 // ---------------------------------------------------------------------------- 3292 3293 void 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 } 3260 3323 3261 3324 BOOLEAN spectrumProc( leftv result,leftv first ) … … 3577 3640 else 3578 3641 { 3579 spectrum s1 ( l1 );3580 spectrum s2 ( l2 );3642 spectrum s1= spectrumFromList ( l1 ); 3643 spectrum s2= spectrumFromList ( l2 ); 3581 3644 spectrum sum( s1+s2 ); 3582 3645 3583 3646 result->rtyp = LIST_CMD; 3584 result->data = (char*)( sum.thelist());3647 result->data = (char*)(getList(sum)); 3585 3648 } 3586 3649 … … 3619 3682 else 3620 3683 { 3621 spectrum s ( l );3684 spectrum s= spectrumFromList( l ); 3622 3685 spectrum product( k*s ); 3623 3686 3624 3687 result->rtyp = LIST_CMD; 3625 result->data = (char*) product.thelist();3688 result->data = (char*)getList(product); 3626 3689 } 3627 3690 … … 3661 3724 else 3662 3725 { 3663 spectrum s1 ( l1 );3664 spectrum s2 ( l2 );3726 spectrum s1= spectrumFromList( l1 ); 3727 spectrum s2= spectrumFromList( l2 ); 3665 3728 3666 3729 res->rtyp = INT_CMD; … … 3691 3754 // ---------------------------------------------------------------------------- 3692 3755 3693 spectrumState spectrumPolyList::spectrum( lists *L,int fast ) 3694 { 3695 spectrumPolyNode **node = &root; 3756 /* former spectrumPolyList::spectrum ( lists*, int) */ 3757 spectrumState spectrumStateFromList( spectrumPolyList& speclist, lists *L,int fast ) 3758 { 3759 spectrumPolyNode **node = &speclist.root; 3696 3760 spectrumPolyNode *search; 3697 3761 … … 3818 3882 search = search->next; 3819 3883 } 3820 delete_node( node );3884 speclist.delete_node( node ); 3821 3885 } 3822 3886 … … 3844 3908 int multiplicity = 1; 3845 3909 3846 for( search= root; search!=(spectrumPolyNode*)NULL &&3910 for( search=speclist.root; search!=(spectrumPolyNode*)NULL && 3847 3911 ( fast==0 || search->weight<=smax ); 3848 3912 search=search->next ) -
Singular/ipshell.h
rd16ea9 r47a4c2 16 16 typedef struct _ssubexpr *Subexpr; 17 17 18 BOOLEAN spectrumProc ( leftv,leftv ); 19 BOOLEAN spectrumfProc( leftv,leftv ); 20 BOOLEAN spaddProc ( leftv,leftv,leftv ); 21 BOOLEAN spmulProc ( leftv,leftv,leftv ); 22 BOOLEAN semicProc ( leftv,leftv,leftv ); 23 BOOLEAN semicProc3 ( leftv,leftv,leftv,leftv ); 18 24 19 25 extern leftv iiCurrArgs; -
kernel/semic.cc
rd16ea9 r47a4c2 91 91 92 92 // ---------------------------------------------------------------------------- 93 // Initialize a spectrum deep from another spectrum 94 // ---------------------------------------------------------------------------- 95 96 void spectrum::copy_deep( const spectrum &spec ) 97 { 98 mu = spec.mu; 99 pg = spec.pg; 100 n = spec.n; 101 102 copy_new( n ); 103 104 for( int i=0; i<n; i++ ) 105 { 106 s[i] = spec.s[i]; 107 w[i] = spec.w[i]; 108 } 109 } 110 111 // ---------------------------------------------------------------------------- 93 112 // Copy constructor for spectrum 94 113 // ----------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.