/
artem_ivanov
/
Matrices
Обзор
Документация
Войти
/
artem_ivanov
/
Matrices
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
ConsoleMatrices/MatricesConsole.cs
31 строка
1 KB
Artyom Ivanov
для матриц больших размеров выводится время
21 апр 2023, 12:44
21 апр 2023, 12:44
9f37a57
Код
Авторство
О чём код?
using System; using System.Collections.Generic; using ClassLibraryMatrices; using System.Diagnostics; namespace ConsoleMatrices { internal class MatricesConsole { static void Main(string[] args) { Test(100, 10); Test(100, 25); Test(100, 50); Test(100, 100); Test(100, 250); Test(100, 500); } static void Test(int n, int b) { Console.WriteLine("----------------"); Console.WriteLine(b); Stopwatch sw1 = Stopwatch.StartNew(); Matrix a = new Matrix(n, n, new Random()); Matrix c1 = Matrix.MatrixExponentiation(a, b); sw1.Stop(); Console.WriteLine("Обычный алгоритм: " + sw1.ElapsedMilliseconds); Stopwatch sw2 = Stopwatch.StartNew(); Matrix c2 = Matrix.MatrixExponentiation(a, b); sw2.Stop(); Console.WriteLine("Быстрое возведения в степень: " + sw2.ElapsedMilliseconds); } } }