returns TRUE if there were errors analyze inputs, check them for consistency detects nc_type, DO NOT initialize multiplication but call for it at the end checks the ordering condition and evtl. NDC NOTE: all the data belong to the curr, we change r which may be the same ring, and must have the same representation!
2697{
2700
2701 if( !bSetupQuotient)
2703
2705
2706
2709
2710#if OUTPUT
2712 {
2713 PrintS(
"nc_CallPlural(), Input data, CCC: \n");
2715 }
2717 {
2718 PrintS(
"nc_CallPlural(), Input data, DDD: \n");
2720 }
2721#endif
2722
2723
2724#ifndef SING_NDEBUG
2729#endif
2730
2731 if( (!bBeQuiet) && (r->GetNC() !=
NULL) )
2732 WarnS(
"going to redefine the algebra structure");
2733
2736 matrix C;
bool bCnew =
false;
2737
2741
2742 number nN, pN, qN;
2743
2744 bool IsSkewConstant = false, tmpIsSkewConstant;
2746
2748
2749
2750
2751
2752
2753
2754
2755 {
2757 {
2758 Werror(
"Square %d x %d matrix expected", r->N, r->N);
2760 }
2761 }
2762 if (( CCC !=
NULL) && (CC ==
NULL)) CC = CCC;
2763 if (( CCN !=
NULL) && (CN ==
NULL)) CN = CCN;
2764
2765
2767 {
2769 }
2770 else
2771 {
2773 {
2774 Werror(
"Square %d x %d matrix expected",r->N,r->N);
2776 }
2777 }
2778
2779 if (( DDD !=
NULL) && (DD ==
NULL)) DD = DDD;
2780 if (( DDN !=
NULL) && (DN ==
NULL)) DN = DDN;
2781
2782
2783
2785 {
2786 if (!p_IsConstant(CN,curr))
2787 {
2788 WerrorS(
"Incorrect input : non-constants are not allowed as coefficients (first argument)");
2790 }
2791 assume(p_IsConstant(CN,curr));
2792
2793 nN = pGetCoeff(CN);
2794 if (n_IsZero(nN, curr->cf))
2795 {
2796 WerrorS(
"Incorrect input : zero coefficients are not allowed");
2798 }
2799
2800 if (n_IsOne(nN, curr->cf))
2802 else
2804
2805 IsSkewConstant = true;
2806
2807 C =
mpNew(r->N,r->N);
2808 bCnew = true;
2809
2810 for(
i=1;
i<r->N;
i++)
2811 for(
j=
i+1;
j<=r->N;
j++)
2813
2814#ifndef SING_NDEBUG
2816#endif
2817
2818 }
2819 else if ( (CN ==
NULL) && (CC !=
NULL) )
2820 {
2821
2822
2824 pN = n_Init(0,curr->cf);
2825
2826 if( r->N > 1 )
2828 {
2829 if (!pN_set) n_Delete(&pN,curr->cf);
2832 }
2833
2834 tmpIsSkewConstant = true;
2835
2836 for(
i=1;
i<r->N;
i++)
2837 for(
j=
i+1;
j<=r->N;
j++)
2838 {
2841 else
2842 {
2843 if (!p_IsConstant(
MATELEM(CC,
i,
j),curr))
2844 {
2845 Werror(
"Incorrect input : non-constants are not allowed as coefficients (first argument at [%d, %d])",
i,
j);
2847 }
2850 }
2851
2853
2854 {
2855 WerrorS(
"Incorrect input : matrix of coefficients contains zeros in the upper triangle");
2857 }
2858
2859 if (!n_Equal(pN, qN, curr->cf)) tmpIsSkewConstant = false;
2860 }
2861
2862 if( bCopyInput )
2863 {
2865#ifndef SING_NDEBUG
2867#endif
2868 bCnew = true;
2869 }
2870 else
2871
2872 C = CC;
2873
2874 IsSkewConstant = tmpIsSkewConstant;
2875
2876 if ( tmpIsSkewConstant && n_IsOne(pN, curr->cf) )
2878 else
2880 if (!pN_set) n_Delete(&pN,curr->cf);
2881 }
2882
2883
2885 {
2886 D =
mpNew(r->N,r->N); bDnew =
true;
2887
2889 {
2892 else
2894 }
2895 else
2896 for(
i=1;
i<r->N;
i++)
2897 for(
j=
i+1;
j<=r->N;
j++)
2899#ifndef SING_NDEBUG
2901#endif
2902 }
2903 else
2904 {
2906
2907 for(
int i = 1; (
i < r->N) &&
b;
i++)
2908 for(
int j =
i+1; (
j <= r->N) &&
b;
j++)
2910 {
2912 break;
2913 }
2914
2916 {
2919 else
2921 }
2922
2923 if( bCopyInput )
2924 {
2926#ifndef SING_NDEBUG
2928#endif
2929 bDnew = true;
2930 }
2931 else
2933 }
2934
2937
2938#if OUTPUT
2939 PrintS(
"nc_CallPlural(), Computed data, C: \n");
2941
2942 PrintS(
"nc_CallPlural(), Computed data, D: \n");
2944
2945 Print(
"\nTemporary: type = %d, IsSkewConstant = %d\n", nctype, IsSkewConstant);
2946#endif
2947
2948
2949
2951 {
2954
2955 WerrorS(
"Matrix of polynomials violates the ordering condition");
2957 }
2958
2959
2960
2961
2963
2964 ncRingType(nc_new, nctype);
2965
2968
2970
2971
2972 if (r->GetNC() !=
NULL)
2973 {
2974#ifndef SING_NDEBUG
2975 WarnS(
"Changing the NC-structure of an existing NC-ring!!!");
2976#endif
2978 }
2979
2980 r->GetNC() = nc_new;
2981
2983
2985}
void WerrorS(const char *s)
void nc_rKill(ring r)
complete destructor
void mp_Delete(matrix *a, const ring r)
matrix mpNew(int r, int c)
create a r x c zero-matrix
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
#define MATELEM(mat, i, j)
1-based access to matrix
BOOLEAN gnc_InitMultiplication(ring r, bool bSetupQuotient=false)
BOOLEAN gnc_CheckOrdCondition(matrix D, ring r)
poly prCopyR_NoSort(poly p, ring src_r, ring dest_r)
void PrintS(const char *s)
void Werror(const char *fmt,...)
BOOLEAN rSamePolyRep(ring r1, ring r2)
returns TRUE, if r1 and r2 represents the monomials in the same way FALSE, otherwise this is an analo...