Changeset e82417 in git for libpolys


Ignore:
Timestamp:
Aug 12, 2011, 5:29:12 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
45c9bd3cc75a93224a2ce248f62c450b05c2ec61
Parents:
94a065cc1eef470efefb950abf185f50c06ba20d
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2011-08-12 17:29:12+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 13:22:44+01:00
Message:
ADD: new function "int n_IsParam(number m, const ring r)" a-la onld p_Var
Location:
libpolys/polys
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • libpolys/polys/ext_fields/algext.cc

    r94a065c re82417  
    679679
    680680
    681 number naParam(short iParameter, const coeffs cf)
     681number naParam(const short iParameter, const coeffs cf)
    682682{
    683683  assume(getCoeffType(cf) == ID);
     
    685685  const ring R = cf->extRing;
    686686  assume( R != NULL ); 
    687   assume( 0 <= iParameter && iParameter < rVar(R) );
     687  assume( 0 < iParameter && iParameter <= rVar(R) );
    688688 
    689689  poly p = p_One(R); p_SetExp(p, iParameter, 1, R); p_Setm(p, R);
     
    691691  return (number) p;
    692692}
     693
     694
     695/// if m == var(i)/1 => return i,
     696int naIsParam(number m, const coeffs cf)
     697{
     698  assume(getCoeffType(cf) == ID);
     699
     700  const ring R = cf->extRing;
     701  assume( R != NULL ); 
     702
     703  return p_Var( (poly)m, R );
     704}
  • libpolys/polys/ext_fields/algext.h

    r94a065c re82417  
    8282number naParam(short iParameter, const coeffs cf);
    8383
     84
     85/// if m == var(i)/1 => return i,
     86int naIsParam(number, const coeffs);
     87
    8488#endif
    8589/* ALGEXT_H */
  • libpolys/polys/ext_fields/transext.cc

    r94a065c re82417  
    5454
    5555#include "ext_fields/transext.h"
    56 
    57 
    58 
    59 
    6056
    6157
     
    11321128
    11331129
    1134 number ntParam(short iParameter, const coeffs cf)
     1130number ntParam(const short iParameter, const coeffs cf)
    11351131{
    11361132  assume(getCoeffType(cf) == ID);
     
    11381134  const ring R = cf->extRing;
    11391135  assume( R != NULL ); 
    1140   assume( 0 <= iParameter && iParameter < rVar(R) );
     1136  assume( 0 < iParameter && iParameter <= rVar(R) );
    11411137
    11421138  poly p = p_One(R); p_SetExp(p, iParameter, 1, R); p_Setm(p, R);
     
    11511147  return (number)f;
    11521148}
     1149
     1150
     1151/// if m == var(i)/1 => return i,
     1152int ntIsParam(number m, const coeffs cf)
     1153{
     1154  assume(getCoeffType(cf) == ID);
     1155
     1156  const ring R = cf->extRing;
     1157  assume( R != NULL );
     1158
     1159  fraction f = (fraction)m;
     1160
     1161  if( DEN(f) != NULL )
     1162    return 0;
     1163
     1164  return p_Var( NUM(f), R );
     1165}
  • libpolys/polys/ext_fields/transext.h

    r94a065c re82417  
    124124number ntParam(short iParameter, const coeffs cf);
    125125
     126/// if m == var(i)/1 => return i,
     127int ntIsParam(number, const coeffs);
     128
    126129#endif
    127130/* TRANSEXT_H */
  • libpolys/polys/monomials/ring.cc

    r94a065c re82417  
    2222// #include <???/febase.h>
    2323// #include <???/intvec.h>
    24 //#include <polys/ext_fields/longalg.h>
    25 //#include <polys/ext_fields/longtrans.h>
    2624// #include <coeffs/ffields.h>
    2725#include <polys/monomials/ring.h>
     
    4139// #include <???/maps.h>
    4240// #include <???/matpol.h>
     41
     42
     43#include "ext_fields/algext.h"
     44#include "ext_fields/transext.h"
     45
    4346
    4447#define BITS_PER_LONG 8*SIZEOF_LONG
     
    55685571  const n_coeffType _filed_type = getCoeffType(C);
    55695572
    5570   if ( iParameter < 0 || iParameter >= rPar(r) )
     5573  if ( iParameter <= 0 || iParameter > rPar(r) )
    55715574    // Wrong parameter
    55725575    return NULL;
    55735576
    55745577  if( _filed_type == n_algExt )
    5575   {
    5576     extern number naParam(short iParameter, const coeffs cf);
    55775578    return naParam(iParameter, C);
    5578   }
    55795579 
    55805580  if( _filed_type == n_transExt )
    5581   {
    5582     extern number ntParam(short iParameter, const coeffs cf);
    55835581    return ntParam(iParameter, C);
    5584   }
    55855582   
    55865583  return NULL;
    55875584}
    55885585
     5586
     5587
     5588int n_IsParam(number m, const ring r)
     5589{
     5590  assume(r != NULL);
     5591  const coeffs C = r->cf;
     5592  assume(C != NULL);
     5593
     5594  const n_coeffType _filed_type = getCoeffType(C);
     5595
     5596  if( _filed_type == n_algExt )
     5597    return naIsParam(m, C);
     5598
     5599  if( _filed_type == n_transExt )
     5600    return ntIsParam(m, C);
     5601
     5602  return 0;
     5603}
     5604
  • libpolys/polys/monomials/ring.h

    r94a065c re82417  
    562562
    563563/// return the specified parameter as a (new!) number in the given
    564 /// polynomial ring, or NULL if invalid
     564/// polynomial ring, or NULL if invalid
     565/// parameters (as variables) begin with 1!
    565566number n_Param(const short iParameter, const ring r);
    566567
     568/// if m == var(i)/1 => return i,
     569int n_IsParam(number m, const ring r);
    567570   
    568571/* R, Q, Fp: FALSE */
Note: See TracChangeset for help on using the changeset viewer.