public double SlezTestBig(int size) { var mat1 = new MCJCMatrix(size, size); var mat2 = new MCJCMatrix(size, size); var random = new Random(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { mat1.setAt(i, j, random.NextDouble(), 0); mat2.setAt(i, j, random.NextDouble(), 0); } } var time = DateTime.Now; var lib = new MLapackLib(); var result = new MCJCMatrix(size, size); Console.WriteLine("multiplication started..."); lib.solveSLE(mat1, mat2, result); Console.WriteLine("multiplication completed."); double ms = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("time = " + ms); return(ms); }
public double SvdzTestBig(int size) { var mat1 = new MCJCMatrix(size, size); var random = new Random(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { mat1.setAt(i, j, random.NextDouble(), 0); } } var lib = new MLapackLib(); Console.WriteLine("multiplication started..."); var s = new MCJRMatrix(); var u = new MCJCMatrix(); var vt = new MCJCMatrix(); var time = DateTime.Now; lib.SVDDecomposition(mat1, s, u, vt); double ms = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("time = " + ms); return(ms); }
public void SlezTest() { const int size = 2; var mat1 = new MCJCMatrix(2, 2); var mat2 = new MCJCMatrix(2, 2); mat1.setAt(0, 0, 1, 1); mat1.setAt(0, 1, 2, 2); mat1.setAt(1, 0, 3, 3); mat1.setAt(1, 1, 4, 4); mat2.setAt(0, 0, 1, 0); mat2.setAt(0, 1, 2, 0); mat2.setAt(1, 0, 3, 0); mat2.setAt(1, 1, 4, 0); Console.WriteLine(new NComplexMatrix(mat1)); /* mat1.setAt(0, 0, 1); * mat1.setAt(0, 1, 2); * mat1.setAt(1, 0, 3); * mat1.setAt(1, 1, 4); * * mat2.setAt(0, 0, 1); * mat2.setAt(0, 1, 2); * mat2.setAt(1, 0, 3); * mat2.setAt(1, 1, 4);*/ var time = DateTime.Now; var lib = new MLapackLib(); var result = new MCJCMatrix(size, size); lib.solveSLE(mat1, mat2, result); Console.WriteLine(new NComplexMatrix(result)); double ms = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("time = " + ms); }
public NComplex this[int row, int col] { get { //todo: return(new NComplex(_mat.getAt(row, col), _mat.getAtIm(row, col))); } set { _mat.setAt(row, col, value.Re, value.Im); } }
public void TestMultZ() { var lib = new MLapackLib(); var mat1 = new MCJCMatrix(2, 2); mat1.setAt(0, 0, 1, 0); mat1.setAt(0, 1, 2, 0); mat1.setAt(1, 0, 3, 0); mat1.setAt(1, 1, 4, 0); var mat2 = new MCJCMatrix(2, 2); mat2.setAt(0, 0, 1, 0); mat2.setAt(0, 1, 2, 0); mat2.setAt(1, 0, 3, 0); mat2.setAt(1, 1, 4, 0); var mat3 = new MCJCMatrix(); lib.multiply(mat1, mat2, mat3); Console.WriteLine(new NComplexMatrix(mat3)); }
public double TestMultZBig(int size) { var mat1 = new MCJCMatrix(size, size); var mat2 = new MCJCMatrix(size, size); var random = new Random(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { mat1.setAt(i, j, random.NextDouble(), random.NextDouble()); mat2.setAt(i, j, random.NextDouble(), random.NextDouble()); } } var mat3 = new MCJCMatrix(); var time = DateTime.Now; Console.WriteLine("multiplication started..."); var lib = new MLapackLib(); lib.multiply(mat1, mat2, mat3); double elapsedTime = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("multiplication completed."); Console.WriteLine("size = " + size + "time = " + (DateTime.Now - time).TotalMilliseconds); return(elapsedTime); }
public double TestMultZBig(int size) { var mat1 = new MCJCMatrix(size, size); var mat2 = new MCJCMatrix(size, size); var random = new Random(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { mat1.setAt(i, j, random.NextDouble(), random.NextDouble()); mat2.setAt(i, j, random.NextDouble(), random.NextDouble()); } } var mat3 = new MCJCMatrix(); var time = DateTime.Now; Console.WriteLine("multiplication started..."); var lib = new MLapackLib(); lib.multiply(mat1, mat2, mat3); double elapsedTime = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("multiplication completed."); Console.WriteLine("size = " + size + "time = " + (DateTime.Now - time).TotalMilliseconds); return elapsedTime; }
public void TestMultZ() { var lib = new MLapackLib(); var mat1 = new MCJCMatrix(2, 2); mat1.setAt(0, 0, 1, 0); mat1.setAt(0, 1, 2 ,0); mat1.setAt(1, 0, 3, 0); mat1.setAt(1, 1, 4, 0); var mat2 = new MCJCMatrix(2, 2); mat2.setAt(0, 0, 1, 0); mat2.setAt(0, 1, 2, 0); mat2.setAt(1, 0, 3, 0); mat2.setAt(1, 1, 4, 0); var mat3 = new MCJCMatrix(); lib.multiply(mat1, mat2, mat3); Console.WriteLine(new NComplexMatrix(mat3)); }
public double SvdzTestBig(int size) { var mat1 = new MCJCMatrix(size, size); var random = new Random(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { mat1.setAt(i, j, random.NextDouble(), 0); } } var lib = new MLapackLib(); Console.WriteLine("multiplication started..."); var s = new MCJRMatrix(); var u = new MCJCMatrix(); var vt = new MCJCMatrix(); var time = DateTime.Now; lib.SVDDecomposition(mat1, s, u, vt); double ms = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("time = " + ms); return ms; }
public double SlezTestBig(int size) { var mat1 = new MCJCMatrix(size, size); var mat2 = new MCJCMatrix(size, size); var random = new Random(); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { mat1.setAt(i, j, random.NextDouble(), 0); mat2.setAt(i, j, random.NextDouble(), 0); } } var time = DateTime.Now; var lib = new MLapackLib(); var result = new MCJCMatrix(size, size); Console.WriteLine("multiplication started..."); lib.solveSLE(mat1, mat2, result); Console.WriteLine("multiplication completed."); double ms = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("time = " + ms); return ms; }
public void SlezTest() { const int size = 2; var mat1 = new MCJCMatrix(2, 2); var mat2 = new MCJCMatrix(2, 2); mat1.setAt(0, 0, 1, 1); mat1.setAt(0, 1, 2, 2); mat1.setAt(1, 0, 3, 3); mat1.setAt(1, 1, 4, 4); mat2.setAt(0, 0, 1, 0); mat2.setAt(0, 1, 2, 0); mat2.setAt(1, 0, 3, 0); mat2.setAt(1, 1, 4, 0); Console.WriteLine(new NComplexMatrix(mat1)); /* mat1.setAt(0, 0, 1); mat1.setAt(0, 1, 2); mat1.setAt(1, 0, 3); mat1.setAt(1, 1, 4); mat2.setAt(0, 0, 1); mat2.setAt(0, 1, 2); mat2.setAt(1, 0, 3); mat2.setAt(1, 1, 4);*/ var time = DateTime.Now; var lib = new MLapackLib(); var result = new MCJCMatrix(size, size); lib.solveSLE(mat1, mat2, result); Console.WriteLine(new NComplexMatrix(result)); double ms = (DateTime.Now - time).TotalMilliseconds; Console.WriteLine("time = " + ms); }