Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Курсовая работа (1,08 МБ).docx
Скачиваний:
2
Добавлен:
17.09.2019
Размер:
1.14 Mб
Скачать
    1. Класс транспонирования матрицы (at.Cs)

using System;

namespace Матрица_1_0

{

class AT

{

public void ATR(int ind, Cache ch)

{

int a=0, b=0;

double[,] matr=new double[a,b];

if (ind == 1)

{

a = ch.c;

b = ch.d;

matr = ch.matr1;

}

if (ind==2)

{

a = ch.e;

b = ch.f;

matr = ch.matr2;

}

if (ind == 3)

{

a = ch.g;

b = ch.h;

matr = ch.res;

}

double[,] res = new double[b, a];

for (int i = 0; i < a; i++)

{

for (int j = 0; j < b; j++)

{

res[j,i] = matr[i, j];

}

}

ch.g = b;

ch.h = a;

ch.res = res;

}

}

}

    1. Класс умножения матрицы на число k (Axk.Cs)

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Матрица_1_0

{

class Axk

{

public void Axk2(int ind, double k, Cache ch)

{

int a = 0, b = 0;

double[,] matr = new double[a, b];

if (ind == 1)

{

a = ch.c;

b = ch.d;

matr=ch.matr1;

}

if (ind == 2)

{

a = ch.e;

b = ch.f;

matr = ch.matr2;

}

if (ind == 3)

{

a = ch.g;

b = ch.h;

matr = ch.res;

ch.res = null;

}

double[,] res = new double[a, b];

for (int i = 0; i < a; i++)

{

for (int j = 0; j < b; j++)

{

res[i, j] = Math.Round( matr[i, j]*k, 3);

}

}

ch.g = a;

ch.h = b;

ch.res = res;

}

}

}

    1. Класс получения канонического вида и ранга матрицы (Kan.Cs)

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace Матрица_1_0

{

class Kan

{

public void KV(int ind, Cache ch)

{

int a=0,b=0,n=0;

int uchet = 0;

double[,] matr=new double[a,b];

if (ind==1)

{

a=ch.c;

b=ch.d;

matr=ch.matr1;

}

if (ind == 2)

{

a=ch.e;

b=ch.f;

matr=ch.matr2;

}

q:

if (n < a && n < b)

{

double del = matr[n, n];

if (del != 0)

{

double[] str = new double[b - n];

double umn = 0;

for (int i = n; i < b; i++)

{

matr[n, i] = matr[n, i] / del;

str[i - n] = matr[n, i];

}

for (int i = n + 1; i < a; i++)

{

umn = matr[i, n];

for (int j = n; j < b; j++)

{

matr[i, j] = matr[i, j] - str[j - n] * umn;

}

}

for (int i = n + 1; i < b; i++)

{

matr[n, i] = 0;

}

for (int i = n; i < a; i++)

{

for (int j = n; j < b; j++)

{

if (i == n || j == n)

{

if (matr[i, j] == 0)

{

uchet++;

}

}

}

}

}

}

if (uchet == ((a + b) - 2)-2*n && uchet!=0)

{

uchet=0;

n++;

goto q;

}

else

{

ch.g = a;

ch.h = b;

ch.res = matr;

}

}

public int Rang(int ind, Cache ch)

{

KV(ind, ch);

int rang = 0;

int n = ch.g;

int m = ch.h;

q:

int vrem = 0;

for (int i = 0; i < n; i++)

{

for (int j = 0; j < m; j++)

{

if (i == n - 1 && ch.res[i,j]==0)

{

vrem++;

}

}

}

if (vrem == m)

{

n--;

goto q;

}

else

{

rang = n;

}

return rang;

}

}

}