Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.22 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <cstdlib>
  4. #include <cstring>
  5. #include <fstream>
  6. #include <cstdio>
  7. #include <math.h>
  8. using namespace std;
  9.  
  10. class Matrix
  11. {
  12. private:
  13.     int N;
  14.     double **matrix;
  15. public:
  16.     Matrix()
  17.     {
  18.         // реализация конструктора по умолчанию
  19.         N = 0;
  20.         matrix = new double*[N];
  21.         for (int i = 0; i < N; i++)
  22.         {
  23.             matrix[i] = new double[N];
  24.         }
  25.     }
  26.  
  27.     //-----------------------------------------------------------------------------------------------
  28.  
  29.     Matrix(int n)
  30.     {
  31.         // реализация конструктора с параметрами(просто задаем пустую матрицу N*N)
  32.         N = n;
  33.         matrix = new double*[N];
  34.         for (int i = 0; i < N; i++)
  35.         {
  36.             matrix[i] = new double[N];
  37.         }
  38.         for (int i = 0; i < N; i++)
  39.         {
  40.             for (int j = 0; j < N; j++)
  41.             {
  42.                 matrix[i][j] = 0;
  43.             }
  44.         }
  45.     }
  46.  
  47.     //-----------------------------------------------------------------------------------------------
  48.  
  49.     Matrix(const Matrix &nm)
  50.     {
  51.         // реализация конструктора копии
  52.         N = nm.N;
  53.         matrix = new double*[N];
  54.         for (int i = 0; i < N; i++)
  55.         {
  56.             matrix[i] = new double[N];
  57.         }
  58.  
  59.         for (int i = 0; i < N; i++)
  60.         {
  61.             for (int j = 0; j < N; ++j)
  62.             {
  63.                 matrix[i][j] = nm.matrix[i][j];
  64.             }
  65.         }
  66.     }
  67.  
  68.     //-----------------------------------------------------------------------------------------------
  69.  
  70.     ~Matrix()
  71.     {
  72.         // деструктор класса Matrix
  73.         delete[] matrix; // освободить память, удалив матрицу
  74.     }
  75.  
  76.     //-----------------------------------------------------------------------------------------------
  77.  
  78.     Matrix& operator=(const Matrix &nm)
  79.     {
  80.         // присваивание
  81.         N = nm.N;
  82.         for (int i = 0; i < N; i++)
  83.         {
  84.             for (int j = 0; j < N; ++j)
  85.             {
  86.                 matrix[i][j] = nm.matrix[i][j];
  87.             }
  88.         }
  89.         return *this;
  90.     }
  91.  
  92.     //-----------------------------------------------------------------------------------------------
  93.  
  94.     void Matrix::scan()
  95.     {
  96.         //считывание матрицы
  97.         int i = 0, j = 0;
  98.         for (i = 0; i < N; i++)
  99.         {
  100.             for (j = 0; j < N; j++)
  101.             {
  102.                 scanf("%lf", &matrix[i][j]);
  103.             }
  104.         }
  105.     }
  106.  
  107.     //-----------------------------------------------------------------------------------------------
  108.  
  109.     void Matrix::print()
  110.     {
  111.         // вывод матрицы
  112.         int i = 0, j = 0;
  113.         for (i = 0; i < N; i++)
  114.         {
  115.             for (j = 0; j < N; j++)
  116.             {
  117.                 printf("%lf ", matrix[i][j]);
  118.             }
  119.             printf("\n");
  120.         }
  121.     }
  122.  
  123.     //-----------------------------------------------------------------------------------------------
  124.  
  125.     Matrix operator *(const Matrix &nm) const
  126.     {
  127.         //Перемножение матриц(nm слева)
  128.         int i, j, k;
  129.         double dump;
  130.         Matrix retma(N);
  131.         for (i = 0; i < N; i++)
  132.         {
  133.             for (j = 0; j < N; j++)
  134.             {
  135.                 dump = 0;
  136.                 for (k = 0; k < N; k++)
  137.                 {
  138.                     dump += matrix[k][j] * nm.matrix[i][k];
  139.                 }
  140.                 retma.matrix[i][j] = dump;
  141.             }
  142.         }
  143.         return retma;
  144.     }
  145.  
  146.     //-----------------------------------------------------------------------------------------------
  147.  
  148.     Matrix operator *(const double scalar) const
  149.     {
  150.         //произведение матрицы на скаляр
  151.         int i = 0, j = 0;
  152.         double result = 0;
  153.         Matrix retma(N);
  154.         for (i = 0; i < N; i++)
  155.         {
  156.             for (j = 0; j < N; j++)
  157.             {
  158.                 retma.matrix[i][j] = matrix[i][j] * scalar;
  159.             }
  160.  
  161.         }
  162.         return retma;
  163.     }
  164.  
  165.     //-----------------------------------------------------------------------------------------------
  166.  
  167.     Matrix operator +(const Matrix &v2) const
  168.     {
  169.         //Сумма матриц
  170.         Matrix retma(N);
  171.         int i = 0, j = 0;
  172.         for (i = 0; i < N; i++)
  173.         {
  174.             for (j = 0; j < N; j++)
  175.             {
  176.                 retma.matrix[i][j] = matrix[i][j] + v2.matrix[i][j];
  177.             }
  178.         }
  179.         return retma;
  180.     }
  181.  
  182.     //-----------------------------------------------------------------------------------------------
  183.  
  184.     Matrix operator -(const Matrix &v2) const
  185.     {
  186.         //Матрица слева минус матрица справа
  187.         Matrix retma(N);
  188.         int i = 0, j = 0;
  189.         for (i = 0; i < N; i++)
  190.         {
  191.             for (j = 0; j < N; j++)
  192.             {
  193.                 retma.matrix[i][j] = matrix[i][j] - v2.matrix[i][j];
  194.             }
  195.         }
  196.         return retma;
  197.     }
  198.  
  199.     //-----------------------------------------------------------------------------------------------
  200.  
  201.     double Matrix::elem(const int row, int col) const
  202.     {
  203.         //вызов элемента матрицы по индексу(matrix.elem(row, col))
  204.         return matrix[row][col];
  205.     }
  206.  
  207.     //-----------------------------------------------------------------------------------------------
  208.  
  209.     void Matrix::newelem(const int row, int col, double newel)
  210.     {
  211.         //изменение элемента матрицы(matrix.newelem(row, col, new element)
  212.         matrix[row][col] = newel;
  213.     }
  214.  
  215.     //-----------------------------------------------------------------------------------------------
  216.  
  217.     double Matrix::norma1() const
  218.     {
  219.         //Первая матричная норма(максимум из строковых сумм)
  220.         double norma = 0, sum = 0;
  221.         int i = 0, j = 0;
  222.         for (i = 0; i < N; i++)
  223.         {
  224.             for (j = 0; j < N; j++)
  225.             {
  226.                 sum += fabs(matrix[i][j]);
  227.             }
  228.             if (sum>norma)
  229.             {
  230.                 norma = sum;
  231.             }
  232.             sum = 0;
  233.         }
  234.         return norma;
  235.     }
  236.  
  237.     //-----------------------------------------------------------------------------------------------
  238.  
  239.     Matrix Matrix::transp() const
  240.     {
  241.         //Транспонирование матрицы
  242.         int i = 0, j = 0;
  243.         Matrix A = Matrix(N);
  244.         for (i = 0; i < N; i++)
  245.         {
  246.             for (j = 0; j < N; j++)
  247.             {
  248.                 A.matrix[i][j] = matrix[j][i];
  249.             }
  250.         }
  251.         return A;
  252.     }
  253.  
  254.     //-----------------------------------------------------------------------------------------------
  255.  
  256.     double Matrix::det() const
  257.     {
  258.         //Поиск определителя матрицы
  259.         int i = 0, j = 0, t = 0, k = 0;
  260.         double dump = 0, det=1;
  261.         Matrix A = *this;
  262.         t = 1;
  263.         j = 0;
  264.         while (t < N)
  265.         {
  266.             k = t - 1;
  267.             for (i = t; i < N; i++)
  268.             {
  269.                 dump = A.matrix[i][k] / A.matrix[k][k];
  270.                 for (j = k; j <= N; j++)
  271.                 {
  272.                     A.matrix[i][j] -= A.matrix[k][j] * dump;
  273.                 }
  274.  
  275.             }
  276.             t++;
  277.         }
  278.         for (i = 0; i < N; i++)
  279.         {
  280.             det *= A.matrix[i][i];
  281.         }
  282.        
  283.         return det;
  284.     }
  285.  
  286.     //-----------------------------------------------------------------------------------------------
  287.     Matrix Matrix::obr() const
  288.     {
  289.         //Поиск обратной матрицы
  290.         int i = 0, j = 0, k=0, l=0, q=0, w=0;
  291.         Matrix A = *this;
  292.         Matrix B = Matrix(N - 1);
  293.         Matrix retma = Matrix(N);
  294.         for (i = 0; i < N; i++)
  295.         {
  296.             for (j = 0; j < N; j++)
  297.             {
  298.                 for (k = 0; k < N; k++)
  299.                 {
  300.                     for (l = 0; l < N; l++)
  301.                     {
  302.                         if ((l == j) || (k == i))
  303.                         {
  304.                             continue;
  305.                         }
  306.                         B.newelem(q, w, A.elem(k, l));
  307.                         w++;
  308.                         if (w == N-1)
  309.                         {
  310.                             w = 0;
  311.                             q++;
  312.                         }
  313.                     }
  314.                 }
  315.                 retma.matrix[i][j] = B.det();
  316.                
  317.                 for (k = 0; k < N - 1; k++)
  318.                 {
  319.                     for (l = 0; l < N - 1; l++)
  320.                     {
  321.                         B.newelem(k, l, 0);
  322.                     }
  323.                 }
  324.                 q = 0;
  325.                 w = 0;
  326.             }
  327.         }
  328.         retma = retma.transp()*(1 / A.det());
  329.         return retma;
  330.     }
  331.    
  332.     //-----------------------------------------------------------------------------------------------
  333.  
  334.     double Matrix::norma3() const
  335.     {
  336.         //Первая матричная норма(максимум из столбцевых сумм)
  337.         double norma = 0, sum = 0;
  338.         int i = 0, j = 0;
  339.         for (i = 0; i < N; i++)
  340.         {
  341.             for (j = 0; j < N; j++)
  342.             {
  343.                 sum += fabs(matrix[j][i]);
  344.             }
  345.             if (sum>norma)
  346.             {
  347.                 norma = sum;
  348.             }
  349.             sum = 0;
  350.         }
  351.         return norma;
  352.     }
  353.  
  354.     //-----------------------------------------------------------------------------------------------
  355.  
  356.     Matrix Matrix::rotation(int row, int col)
  357.     {
  358.         //создание матрицы вращения для элемента A(row,col)(matrix.rotation(row, col))
  359.         Matrix retma(N);
  360.         double a = 0, b = 0;
  361.         int i = 0;
  362.         //задание a и b
  363.         a = matrix[col][col] / sqrt(matrix[col][col] * matrix[col][col] + matrix[row][col] * matrix[row][col]);
  364.         b = matrix[row][col] / sqrt(matrix[col][col] * matrix[col][col] + matrix[row][col] * matrix[row][col]);
  365.         //заполнение матрицы единичками
  366.         for (i = 0; i < N; i++)
  367.         {
  368.             retma.matrix[i][i] = 1;
  369.         }
  370.         //запись в матрицу a и b
  371.         retma.matrix[row][row] = a;
  372.         retma.matrix[col][col] = a;
  373.         //условие на элементы(если под диагоналями, то бэшечки распологаются так же, но индексы у нас другие)))))
  374.         retma.matrix[col][row] = b;
  375.         retma.matrix[row][col] = (-1)*b;
  376.  
  377.         return retma;
  378.     }
  379. };
  380.  
  381. //=================================================================================================
  382. //=================================================================================================
  383. //=================================================================================================
  384.  
  385. class Vektor
  386. {
  387. private:
  388.     int N;
  389.     double *vektor;
  390. public:
  391.     Vektor()
  392.     {
  393.         // реализация конструктора по умолчанию
  394.         N = 0;
  395.         vektor = new double[N];
  396.         for (int i = 0; i < N; i++)
  397.         {
  398.             vektor[i] = 0;
  399.         }
  400.     }
  401.  
  402.     //-----------------------------------------------------------------------------------------------
  403.  
  404.     Vektor(int n)
  405.     {
  406.         // реализация конструктора с параметрами(задаем пустой массив размера N)
  407.         N = n;
  408.         vektor = new double[N];
  409.         for (int i = 0; i < N; i++)
  410.         {
  411.             vektor[i] = 0;
  412.         }
  413.     }
  414.  
  415.     //-----------------------------------------------------------------------------------------------
  416.  
  417.     Vektor(const Vektor &nm)
  418.     {
  419.         // реализация конструктора копии
  420.         N = nm.N;
  421.         vektor = new double[N];
  422.         for (int i = 0; i < N; i++)
  423.         {
  424.             vektor[i] = nm.vektor[i];
  425.         }
  426.     }
  427.  
  428.     //-----------------------------------------------------------------------------------------------
  429.  
  430.     ~Vektor()
  431.     {
  432.         // деструктор класса Vektor
  433.         delete[] vektor; // освободить память, удалив вектор
  434.     }
  435.  
  436.     //-----------------------------------------------------------------------------------------------
  437.  
  438.     Vektor& operator=(const Vektor &nm)
  439.     {
  440.         // присваивание
  441.         N = nm.N;
  442.         for (int i = 0; i < N; i++)
  443.         {
  444.             vektor[i] = nm.vektor[i];
  445.         }
  446.         return *this;
  447.     }
  448.  
  449.     //-----------------------------------------------------------------------------------------------
  450.  
  451.     void Vektor::scan()
  452.     {
  453.         //считывание вектора
  454.         for (int i = 0; i < N; i++)
  455.         {
  456.             scanf("%lf", &vektor[i]);
  457.         }
  458.     }
  459.  
  460.     //-----------------------------------------------------------------------------------------------
  461.  
  462.     void Vektor::print()
  463.     {
  464.         // вывод вектора
  465.         for (int i = 0; i < N; i++)
  466.         {
  467.             printf("%lf\n", vektor[i]);
  468.         }
  469.     }
  470.  
  471.     //-----------------------------------------------------------------------------------------------
  472.  
  473.     Vektor operator *(const Matrix &nm) const
  474.     {
  475.         //Перемножение матрицы на вектор(nm слева)
  476.         int i, j;
  477.         double dump;
  478.         Vektor retvek(N);
  479.         for (i = 0; i < N; i++)
  480.         {
  481.             dump = 0;
  482.             for (j = 0; j < N; j++)
  483.             {
  484.                 dump += vektor[j] * nm.elem(i, j);
  485.             }
  486.             retvek.vektor[i] = dump;
  487.         }
  488.         return retvek;
  489.     }
  490.  
  491.     //-----------------------------------------------------------------------------------------------
  492.  
  493.     double operator *(const Vektor &v2) const
  494.     {
  495.         //скалярное произведение векторов
  496.         double result = 0;
  497.         for (int i = 0; i < N; i++)
  498.         {
  499.             result += vektor[i] * v2.vektor[i];
  500.         }
  501.         return result;
  502.     }
  503.  
  504.     //-----------------------------------------------------------------------------------------------
  505.  
  506.     Vektor operator *(const double scalar) const
  507.     {
  508.         //произведение вектора на скаляр
  509.         double result = 0;
  510.         Vektor retvek(N);
  511.         for (int i = 0; i < N; i++)
  512.         {
  513.             retvek.vektor[i] = vektor[i] * scalar;
  514.         }
  515.         return retvek;
  516.     }
  517.  
  518.     //-----------------------------------------------------------------------------------------------
  519.  
  520.     Vektor operator /(const double scalar) const
  521.     {
  522.         //деление вектора на скаляр
  523.         double result = 0;
  524.         Vektor retvek(N);
  525.         for (int i = 0; i < N; i++)
  526.         {
  527.             retvek.vektor[i] = vektor[i] / scalar;
  528.         }
  529.         return retvek;
  530.     }
  531.  
  532.     //-----------------------------------------------------------------------------------------------
  533.  
  534.     Vektor operator +(const Vektor &v2) const
  535.     {
  536.         //Сумма векторов
  537.         Vektor retvek(N);
  538.         for (int i = 0; i < N; i++)
  539.         {
  540.             retvek.vektor[i] = vektor[i] + v2.vektor[i];
  541.         }
  542.         return retvek;
  543.     }
  544.  
  545.     //-----------------------------------------------------------------------------------------------
  546.  
  547.     Vektor operator -(const Vektor &v2) const
  548.     {
  549.         //Вектор слева-вектор справа
  550.         Vektor retvek(N);
  551.         for (int i = 0; i < N; i++)
  552.         {
  553.             retvek.vektor[i] = vektor[i] - v2.vektor[i];
  554.         }
  555.         return retvek;
  556.     }
  557.  
  558.     //-----------------------------------------------------------------------------------------------
  559.  
  560.     double Vektor::norma1() const
  561.     {
  562.         //Первая векторная норма(Сумма модулей координат)
  563.         double norma = 0;
  564.         for (int i = 0; i < N; i++)
  565.         {
  566.             norma += fabs(vektor[i]);
  567.         }
  568.         return norma;
  569.     }
  570.  
  571.     //-----------------------------------------------------------------------------------------------
  572.  
  573.     double Vektor::norma2() const
  574.     {
  575.         //Вторая векторная норма(Корень из суммы квадратов координат)
  576.         double norma = 0;
  577.         for (int i = 0; i < N; i++)
  578.         {
  579.             norma += fabs(vektor[i])*fabs(vektor[i]);
  580.         }
  581.         return sqrt(norma);
  582.     }
  583.  
  584.     //-----------------------------------------------------------------------------------------------
  585.  
  586.     double Vektor::norma3() const
  587.     {
  588.         //Бесконечная норма вектора(максимум из модулей координат)
  589.         double norma = 0;
  590.         int j = 0;
  591.         for (int i = 0; i < N; i++)
  592.         {
  593.             if (norma<fabs(vektor[i]))
  594.             {
  595.                 norma = vektor[i];
  596.                 j = i;
  597.             }
  598.         }
  599.         norma = vektor[j];
  600.         return norma;
  601.     }
  602.  
  603.     //-----------------------------------------------------------------------------------------------
  604.  
  605.     double Vektor::elem(const int row) const
  606.     {
  607.         //вызов элемента векторного столбца по индексу(vektor.elem(row))
  608.         return vektor[row];
  609.     }
  610.  
  611.     //-----------------------------------------------------------------------------------------------
  612.  
  613.     void Vektor::newelem(const int row, double newel)
  614.     {
  615.         //изменение элемента матрицы(vektor.newelem(row, new element)
  616.         vektor[row] = newel;
  617.     }
  618.  
  619.     //-----------------------------------------------------------------------------------------------
  620.  
  621.     Vektor operator ^(const Matrix &nm) const
  622.     {
  623.         //Выражение иксов
  624.         int i, j;
  625.         Vektor retvek(N);
  626.         Matrix newmat = nm;
  627.         //деление на A(i)(j)
  628.         //Столбец свободных коэффициентов
  629.         for (i = 0; i < N; i++)
  630.         {
  631.             vektor[i] = vektor[i] / nm.elem(i, i);
  632.         }
  633.         //матрица
  634.         for (i = 0; i < N; i++)
  635.         {
  636.             for (j = 0; j <= i; j++)
  637.             {
  638.                 newmat.newelem(i, j, newmat.elem(i, j) / newmat.elem(i, i));
  639.             }
  640.         }
  641.         retvek.newelem(0, vektor[0]);//присвоили первый номер
  642.         for (i = 1; i < N; i++)
  643.         {
  644.             retvek.vektor[i] = vektor[i];
  645.             for (j = i - 1; j >= 0; j--)
  646.             {
  647.                 retvek.vektor[i] -= newmat.elem(i, j)*retvek.vektor[j];
  648.             }
  649.         }
  650.         return retvek;
  651.     }
  652. };
  653. double spectr(const Matrix &A, int razm)
  654. {
  655.     double lambdamax = 0;
  656.     int i = 0, q = 0;
  657.     Vektor X = Vektor(razm);
  658.     Vektor XN = Vektor(razm);
  659.     for (i = 0; i < razm; i++)
  660.     {
  661.         X.newelem(i, 1);
  662.     }
  663.     XN = (X*A) / X.norma2();
  664.     while (fabs(XN.norma2() - X.norma2())>0.000001)
  665.     {
  666.         X = XN;
  667.         XN = (X*A) / X.norma2();
  668.         q++;
  669.     }
  670.     lambdamax = XN*XN;
  671.     lambdamax = sqrt(lambdamax);
  672.     return lambdamax;
  673. }
  674. //ПОИСК Q
  675. Matrix findQ(const Matrix &A, int razm)
  676. {
  677.     int e = 0, i = 0, w = 0, q = 0;
  678.     Matrix R = A;
  679.     Matrix Q = R.rotation(0, 1);
  680.     Q = Q.transp();
  681.     for (e = 0; e <= 5; e++)//для нормальной точности нужно минимум 6 итераций
  682.     {
  683.         for (q = 0; q < razm; q++)
  684.         {
  685.             for (w = q + 1; w < razm; w++)
  686.             {
  687.                 Matrix SO = R.rotation(q, w); //создание матрицы вращения
  688.                 R = R*SO;//перемножение матриц
  689.                 if ((w != 1) || (q != 0) || (e != 0))
  690.                 {
  691.                     Q = Q*SO.transp();
  692.                 }
  693.             }
  694.         }
  695.     }
  696.     return Q;
  697. }
  698. int signum(double a)
  699. {
  700.     if (a >= 0)
  701.     {
  702.         return 1;
  703.     }
  704.     if (a < 0)
  705.     {
  706.         return -1;
  707.     }
  708. }
  709. Matrix findR(const Matrix &A, int razm)
  710. {
  711.     int i = 0, j = 0, k = 0, h = 0, q = 0, w = 0;
  712.     double newv = 0;
  713.    
  714.     Vektor V = Vektor(razm);
  715.     Matrix H = Matrix(razm);
  716.     Matrix E = Matrix(razm);
  717.     Matrix V2 = Matrix(razm);
  718.     Matrix Q = Matrix(razm);
  719.     Matrix R = A;
  720.     for (i = 0; i < razm; i++)
  721.     {
  722.         E.newelem(i, i, 1);
  723.     }
  724.     for (i = 0; i < razm - 1; i++)
  725.     {
  726.         for (j = 0; j < razm; j++)
  727.         {
  728.             if (j == i)
  729.             {
  730.                 for (k = i; k < razm; k++)
  731.                 {
  732.                     newv += R.elem(k, i)*R.elem(k, i);
  733.                 }
  734.                 newv = signum(R.elem(i, i))*sqrt(newv) + R.elem(i, i);
  735.                 V.newelem(j, newv);
  736.                 newv = 0;
  737.                 continue;
  738.             }
  739.             if (j < i)
  740.             {
  741.                 V.newelem(j, 0);
  742.                 continue;
  743.             }
  744.             V.newelem(j, R.elem(j, i));
  745.         }
  746.         for (q = 0; q < razm; q++)
  747.         {
  748.             for (w = 0; w < razm; w++)
  749.             {
  750.                 V2.newelem(q, w, V.elem(q)*V.elem(w));
  751.             }
  752.         }
  753.         H = E - (V2)*(2 / (V*V));
  754.         R = R*H;
  755.     }
  756.     return R;
  757. }
  758. int main()
  759. {
  760.     freopen("in.txt", "r", stdin);
  761.     freopen("out.txt", "w", stdout);
  762.     int razm = 0, i = 0, j = 0, k = 0, h = 0, q=0, w=0;
  763.     double maxnorm = 0;
  764.     scanf("%d", &razm);
  765.     Matrix A = Matrix(razm);
  766.     A.scan();
  767.     Vektor B = Vektor(razm);
  768.     Matrix R = Matrix(razm);
  769.     Matrix Q = Matrix(razm);
  770.     do
  771.     {
  772.         //A.print();
  773.         maxnorm = 0;
  774.         for (j = 0; j < razm - 1; j++)
  775.         {
  776.             for (i = razm - 1; i > j; i--)
  777.             {
  778.                 B.newelem(i, A.elem(i, j));
  779.             }
  780.             if (B.norma2()>maxnorm)
  781.             {
  782.                 maxnorm = B.norma2();
  783.             }
  784.             for (k = 0; k < razm - 1; k++)
  785.             {
  786.                 B.newelem(k, 0);
  787.             }
  788.         }
  789.        
  790.     //  R.print();
  791.         A = findR(A, razm);
  792.         h++;
  793.     } while (maxnorm>0.00001);
  794.     A.print();
  795.     printf("\n");
  796.     printf("%d", h);
  797.  
  798.     return 0;
  799. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement