https://hal.archives-ouvertes.fr/hal-02398953
Raw File
Tip revision: c33910a29d53f4e137c225b21a8d59e43327cbf9 authored by Software Heritage on 08 December 2019, 12:26:32 UTC
hal: Deposit 351 in collection hal
Tip revision: c33910a
CMfield.h

#ifndef CMFIELD_H
#define CMFIELD_H
 
#include <iostream>
#include <giac/config.h>
#include <giac/giac.h>

#include <string>
#include <map>
#include <algorithm>
//#include "Util.h"

using namespace std;
using namespace giac;

extern context ct;

class CMfield
{

 public:

  CMfield();
  CMfield(string s);
  CMfield(gen pol, string s);

  bool verbose;

  //  gen eps, precfactor;
  int nd, ndmax, ndrecord, pf; // nd = current number of digits used in realroot, never allowed to go beyond ndmax
                                    // just for fun, we keep track of the largest number of digits needed (ndrecord)!
                                    // pf = precision factor when increasing precision (replaces nd by nd*pf)
  gen prec;

  gen zeronumber, onenumber, twonumber, ten, zerovector;

  gen t1, t2;
  vecteur vars1d;
  vecteur vars2d;
  
  // number field stuff;
  gen minpol, 
    genconj, 
    genasrootof, realgenasrootof,
    realminpol, realgen, 
    xv, sv, // approx values of generator of number field (resp. of totally real field)
    xvi, svi, // box/interval for previous values
    othersvals, // isolating intervals for wrong roots of realminpol
    dc, dr, // degrees of complex/real fields 
    genericreal,
    realgencoeffsinverse;

  bool extend(gen a); 
  bool findRealStructure();

  vecteur realminpolcoeffs, realgenquadnum;

  gen genasrootofpowers;

  gen taugen;
  gen T; // used to encode Thompson groups, in his notation T=(rho, sigma, tau)
  string tag, tautag;
  vecteur vars;
  gen Id, Id2;

  map<string,gen> * sigma_data();
  map<string,gen> * T_data();

  /*
   * linear algebra/number field methods
   */
  void computeXval();
  void increasePrecision();
  void lowerPrecision();

  void red(gen &z); // beware this modifies the argument!
  void vectred(gen &v);
  void matred(gen &M);

  gen myconj(gen g);
  gen vectconj(gen g);
  gen matconj(gen g);

  gen inverse(gen g);
  gen matinverse(gen M);
  gen matinverse2d(gen M);
  
  bool testDependent(gen V, gen W);

  gen evali(gen g, gen prec);
  gen evali(gen g);
  gen vectevali(gen g);
  gen matevali(gen g);

  gen evaln(gen g);
  gen vectevaln(gen g);
  gen matevaln(gen g);

  bool isReal(gen g);

  gen realPart(gen g);

  gen convertToReal(gen g);

  bool checkSign(gen g, int &res);
  bool checkSignAttempt(gen g, int &res);

  void findgenasrootof();
  bool findInField(gen pol, gen approx, gen &res);
  bool findInFieldAttempt(gen pol, gen approx, gen &res);
  /*
   * pol is the minimal polynomial of an algebraic number,
   *  approx is a float approximation of the root
   *   of course if the approx is too crude, this won't work!
   */

  gen e1,e2,e3; // standard basis vectors
  gen createMatrix(vecteur v);
  gen createMatrix(int m, int n, vecteur v);
  bool isScalar(gen M);
  gen mypower(gen M, int k);
  int order(gen M, int k);
  int order(gen M);
  int linearorder(gen M, int k);
  int linearorder(gen M);
  int linearorder2d(gen M, int k);
  int linearorder2d(gen M);

  gen transpose(gen M);

  gen det(gen M);
  gen trace(gen M);
  gen discr(gen z);
  gen discrAdjusted(gen z);

  bool areDep(gen v1, gen v2);
  bool isMultiple(gen A, gen B);
  bool isSameMatrix(gen A, gen B);
  int braidOrder(gen M, gen N, int k);
  int braidOrder(gen M, gen N);
  int braidOrder2d(gen M, gen N, int k);
  int braidOrder2d(gen M, gen N);

  bool siftAttempt(gen &rur, vecteur &res);
  bool safeSift(gen &rur, vecteur &res);

  bool checkSignPol(gen par, gen mpol, gen q, int &res);
  bool checkSignPolAttempt(gen par, gen mpol, gen q, int &res);

  bool identifyQuadraticNumber(gen &te, vecteur &res);
  bool convertRootOf(gen &te, gen &res);
  gen getCoeffs(gen &te);
  gen getCoeffs(gen te, gen pr);

  bool isInList(gen te, vecteur li);

  bool myCheckEqual(gen a0, gen a1, bool &res);

  gen create_identity(int d);
  
};

extern map<string,gen> * minpols;

#endif
back to top