|
From: <in...@dn...> - 2006-01-25 08:56:51
|
Author: marcus
Date: 2006-01-25 03:56:38 -0500 (Wed, 25 Jan 2006)
New Revision: 186
Modified:
trunk/LinearAlgebra/DenseMatrix.cs
trunk/UnitTests/LinearAlgebra/Decomposition/AbstractCholeskyTest.cs
trunk/UnitTests/LinearAlgebra/Decomposition/AbstractLUTest.cs
trunk/UnitTests/LinearAlgebra/Decomposition/AbstractQRTest.cs
trunk/UnitTests/LinearAlgebra/Decomposition/AbstractSvdTest.cs
trunk/UnitTests/UnitTests.csproj
Log:
--problem with last check in
changed all properties in the decomposition classes to methods, since they all call compute (which can be expensive).
Modified: trunk/LinearAlgebra/DenseMatrix.cs
===================================================================
--- trunk/LinearAlgebra/DenseMatrix.cs 2006-01-25 08:54:33 UTC (rev 185)
+++ trunk/LinearAlgebra/DenseMatrix.cs 2006-01-25 08:56:38 UTC (rev 186)
@@ -443,7 +443,7 @@
throw new NotSquareMatrixException(Strings.MustBeSquare);
}
DenseLU lu = new DenseLU(this);
- return lu.Determinant;
+ return lu.Determinant();
}
/// <summary>
Modified: trunk/UnitTests/LinearAlgebra/Decomposition/AbstractCholeskyTest.cs
===================================================================
--- trunk/UnitTests/LinearAlgebra/Decomposition/AbstractCholeskyTest.cs 2006-01-25 08:54:33 UTC (rev 185)
+++ trunk/UnitTests/LinearAlgebra/Decomposition/AbstractCholeskyTest.cs 2006-01-25 08:56:38 UTC (rev 186)
@@ -48,13 +48,13 @@
[Test]
public void PositiveDefinite()
{
- Assert.IsTrue(cholesky.IsPositiveDefinite);
+ Assert.IsTrue(cholesky.IsPositiveDefinite());
}
[Test]
public void NotPositiveDefinite()
{
- Assert.IsFalse(notPD.IsPositiveDefinite);
+ Assert.IsFalse(notPD.IsPositiveDefinite());
}
[Test]
Modified: trunk/UnitTests/LinearAlgebra/Decomposition/AbstractLUTest.cs
===================================================================
--- trunk/UnitTests/LinearAlgebra/Decomposition/AbstractLUTest.cs 2006-01-25 08:54:33 UTC (rev 185)
+++ trunk/UnitTests/LinearAlgebra/Decomposition/AbstractLUTest.cs 2006-01-25 08:56:38 UTC (rev 186)
@@ -48,13 +48,13 @@
[Test]
public void Singular()
{
- Assert.IsTrue(singularLu.IsSingular);
+ Assert.IsTrue(singularLu.IsSingular());
}
[Test]
public void NotSingular()
{
- Assert.IsFalse(lu.IsSingular);
+ Assert.IsFalse(lu.IsSingular());
}
[Test]
@@ -315,9 +315,9 @@
[Test]
public void Determinant()
{
- Assert.AreEqual(0, singularLu.Determinant);
+ Assert.AreEqual(0, singularLu.Determinant());
double expected = -5.006656015927541e248;
- double actual = lu.Determinant;
+ double actual = lu.Determinant();
double error = System.Math.Abs((actual - expected) / expected);
Assert.IsTrue(error < Constants.ACCEPTABLE_ERROR);
}
@@ -413,7 +413,7 @@
public void L1NormConditionNumber()
{
double expected = 0.000539909549815265;
- double actual = lu.L1NormConditionNumber;
+ double actual = lu.L1NormConditionNumber();
double error = System.Math.Abs((actual - expected) / expected);
Console.WriteLine(expected + " : " + actual + " : " + error);
Assert.IsTrue(error < Constants.ACCEPTABLE_ERROR);
@@ -423,7 +423,7 @@
public void InfinityNormConditionNumber()
{
double expected = 0.000522256126360585;
- double actual = lu.InfinityNormConditionNumber;
+ double actual = lu.InfinityNormConditionNumber();
double error = System.Math.Abs((actual - expected) / expected);
Console.WriteLine(expected + " : " + actual + " : " + error);
Assert.IsTrue(error < Constants.ACCEPTABLE_ERROR);
Modified: trunk/UnitTests/LinearAlgebra/Decomposition/AbstractQRTest.cs
===================================================================
--- trunk/UnitTests/LinearAlgebra/Decomposition/AbstractQRTest.cs 2006-01-25 08:54:33 UTC (rev 185)
+++ trunk/UnitTests/LinearAlgebra/Decomposition/AbstractQRTest.cs 2006-01-25 08:56:38 UTC (rev 186)
@@ -47,15 +47,15 @@
[Test]
public void NotFullRank()
{
- Assert.IsFalse(singularQr.IsFullRank);
+ Assert.IsFalse(singularQr.IsFullRank());
}
[Test]
public void FullRank()
{
- Assert.IsTrue(squareQr.IsFullRank);
- Assert.IsTrue(wideQr.IsFullRank);
- Assert.IsTrue(tallQr.IsFullRank);
+ Assert.IsTrue(squareQr.IsFullRank());
+ Assert.IsTrue(wideQr.IsFullRank());
+ Assert.IsTrue(tallQr.IsFullRank());
}
[Test]
Modified: trunk/UnitTests/LinearAlgebra/Decomposition/AbstractSvdTest.cs
===================================================================
--- trunk/UnitTests/LinearAlgebra/Decomposition/AbstractSvdTest.cs 2006-01-25 08:54:33 UTC (rev 185)
+++ trunk/UnitTests/LinearAlgebra/Decomposition/AbstractSvdTest.cs 2006-01-25 08:56:38 UTC (rev 186)
@@ -381,48 +381,48 @@
[Test]
public void Rank()
{
- int rank = squareSvd.Rank;
+ int rank = squareSvd.Rank();
Assert.AreEqual(squareMatrix.Rows, rank);
- rank = tallSvd.Rank;
+ rank = tallSvd.Rank();
Assert.AreEqual(tallMatrix.Columns, rank);
- rank = wideSvd.Rank;
+ rank = wideSvd.Rank();
Assert.AreEqual(wideMatrix.Rows, rank);
- rank = singularSvd.Rank;
+ rank = singularSvd.Rank();
Assert.AreEqual(squareMatrix.Rows - 1, rank);
}
[Test]
public void Norm()
{
- double norm = squareSvd.Norm2;
+ double norm = squareSvd.Norm2();
Assert.AreEqual(1011.4190766097751, norm, ACCEPTABLE_ERROR);
- norm = tallSvd.Norm2;
+ norm = tallSvd.Norm2();
Assert.AreEqual(445.27398550522514, norm, ACCEPTABLE_ERROR);
- norm = wideSvd.Norm2;
+ norm = wideSvd.Norm2();
Assert.AreEqual(385.51714390506197, norm, ACCEPTABLE_ERROR);
- norm = singularSvd.Norm2;
+ norm = singularSvd.Norm2();
Assert.AreEqual(2, norm, ACCEPTABLE_ERROR);
}
[Test]
public void ConditionNumber()
{
- double cn = squareSvd.ConditionNumber;
+ double cn = squareSvd.ConditionNumber();
Assert.AreEqual(207.5103850393096, cn, 1e-4);
- cn = tallSvd.ConditionNumber;
+ cn = tallSvd.ConditionNumber();
Assert.AreEqual(5.01902319723716, cn, ACCEPTABLE_ERROR);
- cn = wideSvd.ConditionNumber;
+ cn = wideSvd.ConditionNumber();
Assert.AreEqual(3.65923703921971, cn, ACCEPTABLE_ERROR);
- cn = singularSvd.ConditionNumber;
+ cn = singularSvd.ConditionNumber();
Assert.Greater(cn, 1e16);
}
}
Modified: trunk/UnitTests/UnitTests.csproj
===================================================================
--- trunk/UnitTests/UnitTests.csproj 2006-01-25 08:54:33 UTC (rev 185)
+++ trunk/UnitTests/UnitTests.csproj 2006-01-25 08:56:38 UTC (rev 186)
@@ -59,7 +59,7 @@
<Compile Include="LinearAlgebra\Decomposition\DenseLUTest.cs">
<SubType>Code</SubType>
</Compile>
- <Compile Include="LinearAlgebra\DenesMatrixTest.cs" />
+ <Compile Include="LinearAlgebra\DenseMatrixTest.cs" />
<Compile Include="LinearAlgebra\DenseVectorTest.cs" />
<Compile Include="LinearAlgebra\IO\DelimitedMatrixReader.cs" />
<Compile Include="LinearAlgebra\IO\DelimitedMatrixWriter.cs" />
|