Flame of Soul
Главная | Регистрация | Вход

Мои записи


Главная » Статьи » Алгоритмы » Численные методы

[CPP] Решение СЛАУ методом Краммера
|=------------------=[ Magic Technologic Inc.]=------------------=|
|=-----=[ Volume 0x0c, Algoritms 0x11, Phile #0x0a of 0x0f ]=----=|
|=---------------------------------------------------------------=|
|=--------------=[ Решение СЛАУ методом Краммера ]=--------------=|
|=---------------------------------------------------------------=|
|=---------------=[ Copyright (c) Flame Of Soul ]=---------------=|
|=--------------=[ [E-mail]: _allbasse@yandex.ru ]=--------------=|
|=---------------------------------------------------------------=|
|=----------------------------=[ CPP ]=--------------------------=|
|=---------------------------------------------------------------=| #include <iostream.h>  
#include <stdio.h>
#include <math.h>
double DET (unsigned int columns);
bool PROVCOL(unsigned int num, char colNum);
unsigned int Column1(unsigned int num, char colNum);
unsigned int Column0(unsigned int num, char colNum);
double **Matrix;
int n;
main()
{
     int i, j;
     double mainDET;
     cout<<"Vvedite kolichestvo uravneniy "<<endl;
     cin>>n;
     while (n > 10 || n < 1)
     {
          cout<<"Vu ne mogete vvesti bol'she 10 ili
                men'she 1 uravneniya, vvedite esche raz ";
          cin>>n;
     }
     
     Matrix = (double**) new double[n];
     for (i=0; i<= n-1; i++)
     {Matrix[i] = new double[n+1];}
     for (i = 0; i <= n-1; i++)
               for (j = 0; j <= n; j++)
               {
cout<<"Vvedite element matricu s koordinatami ("<<i<<","<<j<<") ";
cin>>Matrix[i][j];
               }
     cout<<"Vasha matrica:\n";
     for (i = 0; i <= n-1; i++)
     {for (j = 0; j <= n; j++)
          cout<<Matrix[i][j]<<"\t";
          cout<<endl;
     }
     mainDET = DET(pow(2,n));
     if (mainDET == 0)
     {
         cout<<"Net resheniy!\n";
     }
     else
     {
      printf ("Korni sistemu:\n");
               for (i=0; i <= n-1; i++)
               printf ("%.3f ", -pow(-1,n+i)*DET(pow(2,i))/mainDET);
          printf ("\n");
     }
     cout<<"Detrmenant sistemu raven: "<<mainDET<<endl;
     for (i = 0; i <= (n-1); i++)
     delete Matrix[i];
     delete Matrix;
     cout<<"Vuchisleniya zakonchenu. Spasibo chto vubrali nas!\n";
     return 0;
}


double DET (unsigned int columns)
{double det = 0;
    int i, numCols = 0, lastFalse, cntr = 0;
     for (i=0; i<=n; i++)
     {
      if (PROVCOL(columns, i))
      numCols++;
      else lastFalse = i;
     }
    if ((n - numCols) == 0) det = Matrix[n-1][lastFalse];
     else
         for (i = 0; i <= n; i++)
               if (!PROVCOL(columns, i))
               {
                   columns = Column1(columns, i);
                   det += pow(-1,(cntr))*Matrix[numCols-1][i]*DET(columns);
                   columns = Column0(columns, i);
                   cntr++;
               }
     return det;
}
bool PROVCOL(unsigned int num, char colNum){
     _asm {
          xor eax, eax;
          xor ebx, ebx;
          mov bl, colNum;
          bt num, ebx;
          jnc none;
          inc eax;
          none:}}

unsigned int Column1(unsigned int num, char colNum){
     _asm {
          xor eax, eax;
          mov al, colNum;
          bts num, eax;}
     return num;}

unsigned int Column0(unsigned int num, char colNum){
     _asm {
          xor eax, eax;
          mov al, colNum;
          btr num, eax;}
return num;}
|=-----------------------------=[ CPP ]=---------------------------=|
|=-----------------------------------------------------------------=|

Категория: Численные методы | Добавил: flame (29.05.2009)
Просмотров: 1497 | Комментарии: 12 | Рейтинг: 0.0/0 |
Всего комментариев: 121 2 »
12  
692107 http://clomidtopreview.net/#181414 clomid online canada drugs http://clomidtopreview.net/#240019 - clomidtopreview.net clomid online order ovulation induction

11  
223752 http://mycashadvance.pro/#470298 payday loan in austin tx

10  
803518 http://tenpaydayloans.co.uk/#307794 no bank account payday advance

9  
http://sildenafilok.net/#34577 buy sildenafil http://sildenafilok.net/#471718 - sildenafil online sniff viagra buy

8  
513611 http://paydayloansall.net/#723779 payday loan seattle

7  
http://www.thumbshots.net/search.aspx?q=site%3aloveepicentre.com
help studying for pharmacy tech http://sundrugstore.net/products/prilosec.htm keeping products with sudephedrine behind the pharmacy counters
http://www.frootful.net/search/?searchfield=site:loveepicentre.com
http://suche.gmx.net/search/web/?su=site%3Aloveepicentre.com

6  
west bend pharmacy http://sundrugstore.net/products/avapro.htm save mart pharmacy porterville

5  
[url=][/url]
[url=][/url]
[url=][/url]
[url=][/url]

4  
usa pharmacy http://exclusiverx.com/products/roxithromycin.htm bellview pharmacy

3  
zehrs pharmacy http://exclusiverx.com/products/plendil.htm link pharmacy

1-10 11-12
Добавлять комментарии могут только зарегистрированные пользователи.
[ Регистрация | Вход ]

Форма входа

Поиск

Статистика


Онлайн всего: 1
Гостей: 1
Пользователей: 0