trop de trucs
All checks were successful
Linux arm64 / Build (push) Successful in 2m33s

This commit is contained in:
2024-05-14 13:00:59 +02:00
parent d9e49d1319
commit a135df2e96
14 changed files with 98 additions and 214 deletions

View File

@@ -1,49 +0,0 @@
#pragma once
#include <string>
#include <gmp.h>
/**
* \class BigInt
* \brief Représente un entier d'une taille quelconque
* \warning Prend énormément de place en mémoire. À utiliser avec précaution !
*/
class BigInt {
private:
mpz_t m_Data;
public:
BigInt(std::string&& a_Number);
BigInt(long a_Number = 0);
BigInt(const BigInt& a_Copy);
BigInt(BigInt&& a_Move);
~BigInt();
BigInt operator+(const BigInt& a_Other);
BigInt operator-(const BigInt& a_Other);
BigInt operator*(const BigInt& a_Other);
BigInt operator/(const BigInt& a_Other);
BigInt operator+=(const BigInt& a_Other);
BigInt operator-=(const BigInt& a_Other);
BigInt operator*=(const BigInt& a_Other);
BigInt operator/=(const BigInt& a_Other);
bool operator==(const BigInt& a_Other);
void operator=(const BigInt& a_Other);
const std::string ToString() const;
bool IsEqualZero() const;
};

View File

@@ -10,14 +10,10 @@
class Matrix;
class Vect;
class VectAffine;
class BigInt;
std::ostream& operator<<(std::ostream& stream, const Matrix& mat);
std::istream& operator>>(std::istream& stream, Matrix& mat);
std::ostream& operator<<(std::ostream& stream, const BigInt& nbre);
std::istream& operator>>(std::istream& stream, BigInt& nbre);
/**
* \brief Charge une matrice à partir d'un fichier
* \param fileName Le chemin du fichier à charger

View File

@@ -10,7 +10,7 @@
#include <string>
#include <vector>
#include "BigInt.h"
#include "NR.h"
/**
* \class Matrix
@@ -18,7 +18,7 @@
*/
class Matrix {
public:
typedef long double Element;
typedef NR Element;
typedef std::vector<Element>::iterator iterator;
private:
@@ -151,7 +151,7 @@ class Matrix {
iterator begin();
iterator end();
iterator GetLineIterator(std::size_t a_Raw);
};
@@ -171,6 +171,6 @@ inline bool IsEqualZero(const long& var) {
}
template <>
inline bool IsEqualZero(const BigInt& var) {
return var.IsEqualZero();
}
inline bool IsEqualZero(const NR& var) {
return var == 0;
}

View File

@@ -3,17 +3,20 @@
#include <iostream>
class NR {
public:
using Int = long long;
private:
int m_Numerator;
int m_Denominator; // has to be > 0, sign is carried by the numerator
Int m_Numerator;
Int m_Denominator; // has to be > 0, sign is carried by the numerator
public:
NR();
NR(int entier);
NR(int numerator, int denominator); // check if denominator != 0
NR(Int entier);
NR(Int numerator, Int denominator); // check if denominator != 0
int GetNumerator() const;
int GetDenominator() const;
Int GetNumerator() const;
Int GetDenominator() const;
bool operator==(const NR& opNR) const;
bool operator<(const NR& opNR) const;
@@ -43,5 +46,3 @@ class NR {
private:
void Reduce();
};
int PGCD(int x, int y);