Esempio n. 1
0
// Ditto above, but for doubles
void m3dMatrixMultiply44(M3DMatrix33d product, const M3DMatrix33d a, const M3DMatrix33d b )
{
	for (int i = 0; i < 3; i++) {
		double ai0=A33(i,0),  ai1=A33(i,1),  ai2=A33(i,2);
		P33(i,0) = ai0 * B33(0,0) + ai1 * B33(1,0) + ai2 * B33(2,0);
		P33(i,1) = ai0 * B33(0,1) + ai1 * B33(1,1) + ai2 * B33(2,1);
		P33(i,2) = ai0 * B33(0,2) + ai1 * B33(1,2) + ai2 * B33(2,2);
	}
}
Esempio n. 2
0
///////////////////////////////////////////////////////////////////////////////
// Multiply two 3x3 matricies
void m3dMatrixMultiply33(M3DMatrix33f product, const M3DMatrix33f a, const M3DMatrix33f b )
{
	for (int i = 0; i < 3; i++) {
		float ai0=A33(i,0), ai1=A33(i,1),  ai2=A33(i,2);
		P33(i,0) = ai0 * B33(0,0) + ai1 * B33(1,0) + ai2 * B33(2,0);
		P33(i,1) = ai0 * B33(0,1) + ai1 * B33(1,1) + ai2 * B33(2,1);
		P33(i,2) = ai0 * B33(0,2) + ai1 * B33(1,2) + ai2 * B33(2,2);
	}
}
int main()
{
    std::cout << "============== Test 1 ==============" << std::endl << std::endl;

    DoubleInterval A00(2,3);
    DoubleInterval A01(0,1);
    DoubleInterval A10(1,2);
    DoubleInterval A11(2,3);
    DoubleInterval B0(0,120);
    DoubleInterval B1(60,240);

    DoubleMatrix *A = new DoubleMatrix(2,2);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    DoubleVector *b = new DoubleVector(2, (DoubleInterval)0);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    DoubleVector *x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    //Solution should be [[-120,90], [-60,240]]^T

    delete A;
    delete b;
    delete x;

    /*std::cout << "============== Test 2 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = 2;
    (*A)(0,1) = 1;
    (*A)(0,2) = -1;
    (*A)(1,0) = -3;
    (*A)(1,1) = -1;
    (*A)(1,2) = 2;
    (*A)(2,0) = -2;
    (*A)(2,1) = 1;
    (*A)(2,2) = 2;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 8;
    (*b)[1] = -11;
    (*b)[2] = -3;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //Solution should be [2, 3, -1]^T

    std::cout << "============== Test 3 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    (*A)(0,0) = 1;
    (*A)(0,1) = -2;
    (*A)(1,0) = 2;
    (*A)(1,1) = -1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    (*b)[0] = 3;
    (*b)[1] = 9;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //Solution should be [5, 1]^T

    std::cout << "============== Test 4 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = 2;
    (*A)(0,1) = 3;
    (*A)(0,2) = 1;
    (*A)(1,0) = 1;
    (*A)(1,1) = 1;
    (*A)(1,2) = 1;
    (*A)(2,0) = 3;
    (*A)(2,1) = 4;
    (*A)(2,2) = 2;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 1;
    (*b)[1] = 3;
    (*b)[2] = 4;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //There shouldn't be an exact solution as it has free variables

    std::cout << "============== Test 5 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = 1;
    (*A)(0,1) = 3;
    (*A)(0,2) = 1;
    (*A)(1,0) = 1;
    (*A)(1,1) = 1;
    (*A)(1,2) = -1;
    (*A)(2,0) = 3;
    (*A)(2,1) = 11;
    (*A)(2,2) = 5;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 9;
    (*b)[1] = 1;
    (*b)[2] = 35;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //There shouldn't be an exact solution as it has free variables

    std::cout << "============== Test 6 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,2);
    (*A)(0,0) = 1;
    (*A)(0,1) = 1;
    (*A)(1,0) = 2;
    (*A)(1,1) = 3;
    (*A)(2,0) = 3;
    (*A)(2,1) = -2;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 0;
    (*b)[1] = 0;
    (*b)[2] = 0;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //There should be an exact solution as even though the system is overdetermined but
    //as the Rank is 2 and the amount of unknowns is 2

    std::cout << "============== Test 7 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(4,4);
    (*A)(0,0) = 1;
    (*A)(0,1) = 1;
    (*A)(0,2) = 1;
    (*A)(0,3) = 1;
    (*A)(1,0) = 2;
    (*A)(1,1) = 3;
    (*A)(1,2) = -1;
    (*A)(1,3) = -1;
    (*A)(2,0) = 3;
    (*A)(2,1) = 2;
    (*A)(2,2) = 1;
    (*A)(2,3) = 1;
    (*A)(3,0) = 3;
    (*A)(3,1) = 6;
    (*A)(3,2) = -1;
    (*A)(3,3) = -1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(4, (DoubleInterval)0);
    (*b)[0] = 0;
    (*b)[1] = 2;
    (*b)[2] = 5;
    (*b)[3] = 4;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(4, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //There should be no solutions as the system is inconsistent

    std::cout << "============== Test 8 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(4,3);
    (*A)(0,0) = -1;
    (*A)(0,1) = 2;
    (*A)(0,2) = -1;
    (*A)(1,0) = -2;
    (*A)(1,1) = 2;
    (*A)(1,2) = 1;
    (*A)(2,0) = 3;
    (*A)(2,1) = 2;
    (*A)(2,2) = 2;
    (*A)(3,0) = -3;
    (*A)(3,1) = 8;
    (*A)(3,2) = 5;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(4, (DoubleInterval)0);
    (*b)[0] = 2;
    (*b)[1] = 4;
    (*b)[2] = 5;
    (*b)[3] = 17;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //There should be an exact solution as even though the system is overdetermined but
    //as the Rank is 3 and the amount of unknowns is 3

    std::cout << "============== Test 9 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,4);
    (*A)(0,0) = 1;
    (*A)(0,1) = 3;
    (*A)(0,2) = 1;
    (*A)(0,3) = 1;
    (*A)(1,0) = 2;
    (*A)(1,1) = -2;
    (*A)(1,2) = 1;
    (*A)(1,3) = 2;
    (*A)(2,0) = 1;
    (*A)(2,1) = -5;
    (*A)(2,2) = 0;
    (*A)(2,3) = 1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 3;
    (*b)[1] = 8;
    (*b)[2] = 5;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(4, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //It is an undetermined system, so no exact solution as it has free variables

    std::cout << "============== Test 10 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,4);
    (*A)(0,0) = 1;
    (*A)(0,1) = 0;
    (*A)(0,2) = 0;
    (*A)(0,3) = 1;
    (*A)(1,0) = 0;
    (*A)(1,1) = 1;
    (*A)(1,2) = 0;
    (*A)(1,3) = 1;
    (*A)(2,0) = 0;
    (*A)(2,1) = 0;
    (*A)(2,2) = 1;
    (*A)(2,3) = 1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 1;
    (*b)[1] = 1;
    (*b)[2] = 1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(4, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 11 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(4,4);
    (*A)(0,0) = 1;
    (*A)(0,1) = -1;
    (*A)(0,2) = 1;
    (*A)(0,3) = -1;
    (*A)(1,0) = -1;
    (*A)(1,1) = 1;
    (*A)(1,2) = -1;
    (*A)(1,3) = 1;
    (*A)(2,0) = 1;
    (*A)(2,1) = -1;
    (*A)(2,2) = 1;
    (*A)(2,3) = -1;
    (*A)(3,0) = -1;
    (*A)(3,1) = 1;
    (*A)(3,2) = -1;
    (*A)(3,3) = 1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(4, (DoubleInterval)0);
    (*b)[0] = 0;
    (*b)[1] = 0;
    (*b)[2] = 0;
    (*b)[3] = 0;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(4, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //It is an underdetermined system, so no exact solution as it has free variables
    //fails here though because no pivoting is done

    std::cout << "============== Test 12 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = 1;
    (*A)(0,1) = 2;
    (*A)(0,2) = 3;
    (*A)(1,0) = 4;
    (*A)(1,1) = 5;
    (*A)(1,2) = 6;
    (*A)(2,0) = 7;
    (*A)(2,1) = 8;
    (*A)(2,2) = 9;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 0;
    (*b)[1] = 0;
    (*b)[2] = 0;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //There shouldn't be an exact solution as it has free variables

    std::cout << "============== Test 13 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = 1;
    (*A)(0,1) = -1;
    (*A)(0,2) = 2;
    (*A)(1,0) = 0;
    (*A)(1,1) = 0;
    (*A)(1,2) = -1;
    (*A)(2,0) = 0;
    (*A)(2,1) = 2;
    (*A)(2,2) = -1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 8;
    (*b)[1] = -11;
    (*b)[2] = -3;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //Should gave the same result as test 14 if pivoting has been implemented correctly

    std::cout << "============== Test 14 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = 1;
    (*A)(0,1) = -1;
    (*A)(0,2) = 2;
    (*A)(1,0) = 0;
    (*A)(1,1) = 2;
    (*A)(1,2) = -1;
    (*A)(2,0) = 0;
    (*A)(2,1) = 0;
    (*A)(2,2) = -1;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = 8;
    (*b)[1] = -3;
    (*b)[2] = -11;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
    	x = hansen_gaussian_elimination_v1(*A,*b);
    	if(x != NULL)
    	{
    		std::cout << "x = " << std::endl;
    		std::cout << *x << std::endl << std::endl;
    	}
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    //Same system of equations as test 13*/

    std::cout << "============== Test 15 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    (*A)(0,0) = A10;
    (*A)(0,1) = A11;
    (*A)(1,0) = A00;
    (*A)(1,1) = A01;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    (*b)[0] = B1;
    (*b)[1] = B0;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 16 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    A00.assign(3,4);
    A01.assign(1,2);
    A10.assign(0,1);
    A11.assign(7,8);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(2,4);
    B1.assign(-1,1);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 17 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    A00.assign(2,4);
    A01.assign(8,10);
    A10.assign(2,4);
    A11.assign(4,6);
    (*A)(0,0) = -A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(4,6);
    B1.assign(8,10);
    (*b)[0] = -B0;
    (*b)[1] = -B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 18 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(4,4);
    A00.assign(4,6);
    A01.assign(-6,-4);
    A10.assign(9,11);
    A11.assign(-11,-9);
    DoubleInterval A33(-1,1);

    (*A)(0,0) = A00;
    (*A)(0,1) = A33;
    (*A)(0,2) = A33;
    (*A)(0,3) = A33;
    (*A)(1,0) = A33;
    (*A)(1,1) = A01;
    (*A)(1,2) = A33;
    (*A)(1,3) = A33;
    (*A)(2,0) = A33;
    (*A)(2,1) = A33;
    (*A)(2,2) = A10;
    (*A)(2,3) = A33;
    (*A)(3,0) = A33;
    (*A)(3,1) = A33;
    (*A)(3,2) = A33;
    (*A)(3,3) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(4, (DoubleInterval)0);
    B0.assign(-2,4);
    B1.assign(1,8);
    DoubleInterval B2(-4,10);
    DoubleInterval B3(2,12);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    (*b)[3] = B3;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(4, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 19 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(-14,14);
    B1.assign(-9,9);
    B2.assign(-3,3);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 20 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(-14,0);
    B1.assign(-9,0);
    B2.assign(-3,0);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 21 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(0,14);
    B1.assign(0,9);
    B2.assign(0,3);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 22 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(2,14);
    B1.assign(-9,-3);
    B2.assign(-3,1);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(3, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    std::cout << "============== Test 23 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);

    A00.assign(2,3);
    A01.assign(-1,1);
    A10.assign(0,5);
    A11.assign(3,4);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(2,14);
    B1.assign(3,9);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    x = new DoubleVector(2, (DoubleInterval)0);

    try
    {
        x = hansen_gaussian_elimination_v1(*A,*b);
        if(x != NULL)
        {
            std::cout << "x = " << std::endl;
            std::cout << *x << std::endl << std::endl;
        }
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;
    delete x;

    return 0;
}
int main()
{
    std::cout << "============== Test 1 ==============" << std::endl << std::endl;

    DoubleInterval A00(2,3);
    DoubleInterval A01(0,1);
    DoubleInterval A10(1,2);
    DoubleInterval A11(2,3);
    DoubleInterval B0(0,120);
    DoubleInterval B1(60,240);

    DoubleMatrix *A = new DoubleMatrix(2,2);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    DoubleVector *b = new DoubleVector(2, (DoubleInterval)0);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 2 ==============" << std::endl << std::endl;

    A00.assign(-1,3);

    A = new DoubleMatrix(2,2);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 3 ==============" << std::endl << std::endl;

    A00.assign(2,3);
    A01.assign(-5,6);

    A = new DoubleMatrix(2,2);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(1,3);
    B1.assign(3,4);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 4 ==============" << std::endl << std::endl;

    A00.assign(-2,1);
    A01.assign(1,5);

    A = new DoubleMatrix(2,2);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(1,3);
    B1.assign(3,4);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 5 ==============" << std::endl << std::endl;

    A00.assign(2,3);
    A01.assign(3,4);
    DoubleInterval A02(1,2);
    DoubleInterval A12(0,1);
    DoubleInterval A21(6,8);
    DoubleInterval A22(4,5);

    B0.assign(0,120);
    B1.assign(310,440);
    DoubleInterval B2(50,120);

    A = new DoubleMatrix(3,3);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = A02;
    (*A)(1,0) = A00;
    (*A)(1,1) = A00;
    (*A)(1,2) = A12;
    (*A)(2,0) = A00;
    (*A)(2,1) = A21;
    (*A)(2,2) = A22;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    /*std::cout << "============== Test 6 ==============" << std::endl << std::endl;

    A00.assign(2,3);

    A = new DoubleMatrix(1,1);
    (*A)(0,0) = A00;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    B0.assign(4,5);

    b = new DoubleVector(1, (DoubleInterval)0);
    (*b)[0] = B0;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
    	get_exact_system(*A,*b, argc, argv);
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 7 ==============" << std::endl << std::endl;

    A00.assign(1,2);

    A = new DoubleMatrix(1,1);
    (*A)(0,0) = A00;
    std::cout << "A: " << std::endl;
    std::cout << *A << std::endl;

    B0.assign(-5,10);

    b = new DoubleVector(1, (DoubleInterval)0);
    (*b)[0] = B0;
    std::cout << "b: " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
    	get_exact_system(*A,*b, argc, argv);
    }
    catch(const std::exception& e)
    {
    	std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
    	std::cout << error << std::endl << std::endl;
    }*/

    std::cout << "============== Test 15 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    (*A)(0,0) = A10;
    (*A)(0,1) = A11;
    (*A)(1,0) = A00;
    (*A)(1,1) = A01;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    (*b)[0] = B1;
    (*b)[1] = B0;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 16 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    A00.assign(3,4);
    A01.assign(1,2);
    A10.assign(0,1);
    A11.assign(7,8);
    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(2,4);
    B1.assign(-1,1);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 17 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);
    A00.assign(2,4);
    A01.assign(8,10);
    A10.assign(2,4);
    A11.assign(4,6);
    (*A)(0,0) = -A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(4,6);
    B1.assign(8,10);
    (*b)[0] = -B0;
    (*b)[1] = -B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 18 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(4,4);
    A00.assign(4,6);
    A01.assign(-6,-4);
    A10.assign(9,11);
    A11.assign(-11,-9);
    DoubleInterval A33(-1,1);

    (*A)(0,0) = A00;
    (*A)(0,1) = A33;
    (*A)(0,2) = A33;
    (*A)(0,3) = A33;
    (*A)(1,0) = A33;
    (*A)(1,1) = A01;
    (*A)(1,2) = A33;
    (*A)(1,3) = A33;
    (*A)(2,0) = A33;
    (*A)(2,1) = A33;
    (*A)(2,2) = A10;
    (*A)(2,3) = A33;
    (*A)(3,0) = A33;
    (*A)(3,1) = A33;
    (*A)(3,2) = A33;
    (*A)(3,3) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(4, (DoubleInterval)0);
    B0.assign(-2,4);
    B1.assign(1,8);
    B2.assign(-4,10);
    DoubleInterval B3(2,12);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    (*b)[3] = B3;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 19 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(-14,14);
    B1.assign(-9,9);
    B2.assign(-3,3);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 20 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(-14,0);
    B1.assign(-9,0);
    B2.assign(-3,0);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 21 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(0,14);
    B1.assign(0,9);
    B2.assign(0,3);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 22 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);
    A00.assign(3.7, 4.3);
    A01.assign(-1.5, -0.5);
    A10.assign(3.7, 4.3);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = (DoubleInterval)0;
    (*A)(1,0) = A01;
    (*A)(1,1) = A10;
    (*A)(1,2) = A01;
    (*A)(2,0) = (DoubleInterval)0;
    (*A)(2,1) = A01;
    (*A)(2,2) = A10;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(2,14);
    B1.assign(-9,-3);
    B2.assign(-3,1);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 23 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(3,3);

    A00.assign(2,3);
    A01.assign(4,5);
    A02.assign(1,2);
    A10.assign(-6,-5);
    A11.assign(-3,-2);
    A12.assign(3,4);
    DoubleInterval A20(-4,0);
    A21.assign(-5,-4);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(0,2) = A02;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    (*A)(1,2) = A12;
    (*A)(2,0) = A20;
    (*A)(2,1) = A21;
    (*A)(2,2) = A00;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(3, (DoubleInterval)0);
    B0.assign(2,14);
    B1.assign(9,300);
    B2.assign(3,100);
    (*b)[0] = B0;
    (*b)[1] = B1;
    (*b)[2] = B2;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 24 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);

    A00.assign(2,3);
    A01.assign(-1,1);
    A10.assign(0,5);
    A11.assign(3,4);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(2,14);
    B1.assign(3,9);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    std::cout << "============== Test 25 ==============" << std::endl << std::endl;

    A = new DoubleMatrix(2,2);

    A00.assign(1,1000);
    A01.assign(1,1000);
    A10.assign(-1000,1);
    A11.assign(1,1000);

    (*A)(0,0) = A00;
    (*A)(0,1) = A01;
    (*A)(1,0) = A10;
    (*A)(1,1) = A11;
    std::cout << "A = " << std::endl;
    std::cout << *A << std::endl;

    b = new DoubleVector(2, (DoubleInterval)0);
    B0.assign(1,2);
    B1.assign(3,4);
    (*b)[0] = B0;
    (*b)[1] = B1;
    std::cout << "b = " << std::endl;
    std::cout << *b << std::endl << std::endl;

    try
    {
        get_exact_system(*A,*b);
    }
    catch(const std::exception& e)
    {
        std::cout << e.what() << std::endl << std::endl;
    }
    catch(std::string& error)
    {
        std::cout << error << std::endl << std::endl;
    }

    delete A;
    delete b;

    return 0;
}