예제 #1
0
		public void NullParameterTestforConstructor4()
		{
			DoubleLevinson dl = new DoubleLevinson(LC5.ToArray(), null as RODoubleVector);
		}
예제 #2
0
		public void ZeroLengthVectorTestsforConstructor1()
		{
			DoubleVector dv = new DoubleVector(1, 0.0);
			dv.RemoveAt(0);
			DoubleLevinson dl = new DoubleLevinson(dv, dv);
		}
예제 #3
0
		public void OrderPropertyTest()
		{
			DoubleLevinson dl = new DoubleLevinson(LC5, TR5);
			Assert.IsTrue(dl.Order == 5);
		}
예제 #4
0
		public void SingularityPropertyTest2()
		{
			DoubleVector LC = new DoubleVector(new double[] { 4.0, 2.0, 1.0, 0.0 });
			DoubleVector TR = new DoubleVector(new double[] { 4.0, 8.0, 2.0, 1.0 });

			DoubleLevinson dl = new DoubleLevinson(LC, TR);
			Assert.IsTrue(dl.IsSingular);
		}
예제 #5
0
		public void FirstElementTestforConstructor2()
		{
			DoubleVector dv = new DoubleVector(3, 1.0);
			DoubleLevinson dl = new DoubleLevinson(LC3.ToArray(), dv.ToArray());
		}
예제 #6
0
		public void GetTopRowTest()
		{
			DoubleLevinson dl = new DoubleLevinson(LC5, TR5);
			DoubleVector TR = dl.GetTopRow();
			Assert.IsTrue(TR5.Equals(TR));
		}
예제 #7
0
		public void MismatchRowsTestforSolveMatrix()
		{
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);
			DoubleMatrix X = dl.Solve(I5);
		}
예제 #8
0
		public void MismatchVectorLengthTestsforConstructor2()
		{
			DoubleLevinson dl = new DoubleLevinson(LC2.ToArray(), TR3.ToArray());
		}
예제 #9
0
		public void SolveVector10()
		{
			int i;
			double e, me;
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);
			DoubleVector X = dl.Solve(Y10);

			// determine the maximum error
			me = 0.0;
			for (i = 0; i < dl.Order; i++)
			{
				e = System.Math.Abs((X10[i] - X[i]) / X10[i]);
				if (e > me)
				{
					me = e;
				}
			}
			Assert.IsTrue(me < Tolerance10, "Maximum Error = " + me.ToString());
		}
예제 #10
0
		public void NullParameterTestforSolveMatrix()
		{
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);
			DoubleMatrix X = dl.Solve(null as DoubleMatrix);
		}
예제 #11
0
		public void MismatchRowsTestforSolveVector()
		{
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);
			DoubleVector X = dl.Solve(X5);
		}
예제 #12
0
		public void NullParameterTestforSolveVector()
		{
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);
			DoubleVector X = dl.Solve(null as DoubleVector);
		}
예제 #13
0
		public void GetDeterminantMethodTest10()
		{
			// calculate determinant from diagonal
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);

			// check results match
			Double e = System.Math.Abs((dl.GetDeterminant() - Det10) / Det10);
			Assert.IsTrue(e < Tolerance10);
		}
예제 #14
0
		public void ZeroLengthVectorTestsforConstructor2()
		{
			double[] dv = new double[0];
			DoubleLevinson dl = new DoubleLevinson(dv, dv);
		}
예제 #15
0
		public void SolveMatrix5()
		{
			int i, j;
			double e, me;
			DoubleLevinson dl = new DoubleLevinson(LC5, TR5);

			// check inverse
			DoubleMatrix I = dl.Solve(DoubleMatrix.CreateIdentity(5));
			me = 0.0;
			for (i = 0; i < dl.Order; i++)
			{
				for (j = 0; j < dl.Order; j++)
				{
					e = System.Math.Abs((I5[i, j] - I[i, j]) / I5[i, j]);
					if (e > me)
					{
						me = e;
					}
				}
			}
			Assert.IsTrue(me < Tolerance5, "Maximum Error = " + me.ToString());
		}
예제 #16
0
		public void MismatchVectorLengthTestsforConstructor1()
		{
			DoubleLevinson dl = new DoubleLevinson(LC2, TR3);
		}
예제 #17
0
		public void GetInverse10()
		{
			int i, j;
			double e, me;
			DoubleLevinson dl = new DoubleLevinson(LC10, TR10);

			// check inverse
			DoubleMatrix I = dl.GetInverse();
			me = 0.0;
			for (i = 0; i < dl.Order; i++)
			{
				for (j = 0; j < dl.Order; j++)
				{
					e = System.Math.Abs((I10[i, j] - I[i, j]) / I10[i, j]);
					if (e > me)
					{
						me = e;
					}
				}
			}
			Assert.IsTrue(me < Tolerance10, "Maximum Error = " + me.ToString());
		}
예제 #18
0
		public void FirstElementTestforConstructor1()
		{
			DoubleVector dv = new DoubleVector(3, 1.0);
			DoubleLevinson dl = new DoubleLevinson(LC3, dv);
		}
예제 #19
0
		public void NullParameterTestforConstructor1()
		{
			DoubleLevinson dl = new DoubleLevinson(null as DoubleVector, TR5);
		}
예제 #20
0
		public void GetLeftColumnTest()
		{
			DoubleLevinson dl = new DoubleLevinson(LC5, TR5);
			DoubleVector LC = dl.GetLeftColumn();
			Assert.IsTrue(LC5.Equals(LC));
		}
예제 #21
0
		public void NullParameterTestforConstructor2()
		{
			DoubleLevinson dl = new DoubleLevinson(LC5, null as DoubleVector);
		}
예제 #22
0
		public void GetMatrixMemberTest()
		{
			DoubleLevinson dl = new DoubleLevinson(LC5, TR5);
			DoubleMatrix dldm = dl.GetMatrix();
			for (int row = 0; row < TR5.Length; row++)
			{
				for (int column = 0; column < TR5.Length; column++)
				{
					if (column < row)
					{
						Assert.IsTrue(dldm[row, column] == LC5[row - column]);
					}
					else
					{
						Assert.IsTrue(dldm[row, column] == TR5[column - row]);
					}
				}
			}
		}
예제 #23
0
		public void NullParameterTestforConstructor3()
		{
			DoubleLevinson dl = new DoubleLevinson(null as RODoubleVector, TR5.ToArray());
		}
예제 #24
0
		public void DecompositionTest2()
		{
			int i, j;
			double e, me;
			DoubleLevinson dl = new DoubleLevinson(LC2, TR2);
			DoubleMatrix U = dl.U;
			DoubleMatrix D = dl.D;
			DoubleMatrix L = dl.L;

			// check the upper triangle
			me = 0.0;
			for (i = 0; i < dl.Order; i++)
			{
				for (j = 0; j < dl.Order; j++)
				{
					if (B2[i, j] != U[i, j])
					{
						e = System.Math.Abs((B2[i, j] - U[i, j]) / B2[i, j]);
						if (e > me)
						{
							me = e;
						}
					}
				}
			}
			Assert.IsTrue(me < Tolerance2, "Maximum Error = " + me.ToString());

			// check the lower triangle
			me = 0.0;
			for (i = 0; i < dl.Order; i++)
			{
				for (j = 0; j < dl.Order; j++)
				{
					if (A2[i, j] != L[i, j])
					{
						e = System.Math.Abs((A2[i, j] - L[i, j]) / A2[i, j]);
						if (e > me)
						{
							me = e;
						}
					}
				}
			}
			Assert.IsTrue(me < Tolerance2, "Maximum Error = " + me.ToString());

			// check the diagonal
			me = 0.0;
			for (i = 0; i < dl.Order; i++)
			{
				e = System.Math.Abs((D2[i] - D[i, i]) / D2[i]);
				if (e > me)
				{
					me = e;
				}
			}

			Assert.IsTrue(me < Tolerance2, "Maximum Error = " + me.ToString());
		}
예제 #25
0
		public void SingularityPropertyTest1()
		{
			DoubleLevinson dl = new DoubleLevinson(LC4, TR4);
			Assert.IsFalse(dl.IsSingular);
		}