flint.hpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. * This file is part of Gomu.
  3. *
  4. * Copyright 2016 by Jean Fromentin <jean.fromentin@math.cnrs.fr>
  5. *
  6. * Gomu is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Gomu is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with Gomu. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef FLINT_HPP
  20. #define FLINT_HPP
  21. #include <iostream>
  22. #include "flint/fmpz.h"
  23. #include "flint/fmpz_mat.h"
  24. #include "flint/fmpz_poly.h"
  25. #include "flint/fmpz_poly_q.h"
  26. #include "flint/fmpz_poly_mat.h"
  27. using namespace std;
  28. ostream& operator<<(ostream&,const fmpz_t);
  29. ostream& operator<<(ostream&,const fmpz_mat_t);
  30. ostream& operator<<(ostream&,const fmpz_poly_t);
  31. ostream& operator<<(ostream&,const fmpz_poly_factor_t);
  32. ostream& operator<<(ostream&,const fmpz_poly_mat_t);
  33. string display(fmpz*);
  34. string display(fmpz_poly_struct*);
  35. string display(fmpz_poly_factor_struct*);
  36. string display(fmpz_poly_q_struct*);
  37. string display(fmpz_mat_struct*);
  38. string display(fmpz_poly_mat_struct*);
  39. string toHtml(const fmpz_t);//obsolete
  40. string toHtml(const fmpz_poly_t);
  41. string toHtml(const fmpz_poly_q_t);
  42. string toHtml(const fmpz_poly_factor_t);
  43. int cmp(fmpz_mat_struct*,fmpz_mat_struct*);
  44. int cmp(fmpz_poly_struct*,fmpz_poly_struct*);
  45. int cmp(fmpz_poly_q_struct*,fmpz_poly_q_struct*);
  46. int cmp(fmpz_poly_factor_struct*,fmpz_poly_factor_struct*);
  47. int cmp(fmpz_poly_mat_struct*,fmpz_poly_mat_struct*);
  48. fmpz* get(const fmpz_mat_t,slong,slong);
  49. fmpz_poly_struct* get(const fmpz_poly_mat_t,slong,slong);
  50. void fmpz_poly_mat_init_set(fmpz_poly_mat_t,fmpz_mat_t);
  51. void dispSage(ostream&,const fmpz_mat_t);
  52. inline ostream& operator<<(ostream& os,const fmpz_t z){
  53. char* str=fmpz_get_str(NULL,10,z);
  54. os<<str;
  55. free(str);
  56. return os;
  57. }
  58. inline ostream& operator<<(ostream& os,const fmpz_poly_t P){
  59. char* str=fmpz_poly_get_str_pretty(P,"x");
  60. os<<str;
  61. free(str);
  62. return os;
  63. }
  64. inline string toHtml(const fmpz_t z){
  65. char* str=fmpz_get_str(NULL,10,z);
  66. string res(str);
  67. return res;
  68. }
  69. inline fmpz* get(const fmpz_mat_t A,slong i,slong j){
  70. return fmpz_mat_entry(A,i,j);
  71. }
  72. inline fmpz_poly_struct* get(const fmpz_poly_mat_t A,slong i,slong j){
  73. return fmpz_poly_mat_entry(A,i,j);
  74. }
  75. #endif