diff --git a/Sources/Accord.Core/Properties/VersionInfo.cs b/Sources/Accord.Core/Properties/VersionInfo.cs index fd83e4290..d50fffde7 100644 --- a/Sources/Accord.Core/Properties/VersionInfo.cs +++ b/Sources/Accord.Core/Properties/VersionInfo.cs @@ -6,4 +6,4 @@ [assembly: AssemblyCultureAttribute("")] [assembly: AssemblyVersionAttribute("3.4.0")] [assembly: AssemblyInformationalVersionAttribute("3.4.0")] -[assembly: AssemblyFileVersionAttribute("3.4.0.5851")] +[assembly: AssemblyFileVersionAttribute("3.4.0.5853")] diff --git a/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.cs b/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.cs index 6518727b4..291caee0e 100644 --- a/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.cs +++ b/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.cs @@ -60,6 +60,29 @@ public sealed class EigenvalueDecomposition : ICloneable private Double[] ort; // storage for nonsymmetric algorithm. private bool symmetric; + private const Double eps = 2 * Constants.DoubleEpsilon; + + + /// + /// Returns the effective numerical matrix rank. + /// + /// + /// Number of non-negligible eigen values. + /// + public int Rank + { + get + { + Double tol = n * d[0] * eps; + + int r = 0; + for (int i = 0; i < d.Length; i++) + if (d[i] > tol) r++; + + return r; + } + } + /// /// Construct an eigenvalue decomposition. /// diff --git a/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.tt b/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.tt index a694e1068..8c5292906 100644 --- a/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.tt +++ b/Sources/Accord.Math/Decompositions/EigenvalueDecomposition.tt @@ -78,6 +78,29 @@ namespace Accord.Math.Decompositions private <#=T#>[] ort; // storage for nonsymmetric algorithm. private bool symmetric; + private const <#=T#> eps = 2 * Constants.<#=T#>Epsilon; + + + /// + /// Returns the effective numerical matrix rank. + /// + /// + /// Number of non-negligible eigen values. + /// + public int Rank + { + get + { + <#=T#> tol = n * d[0] * eps; + + int r = 0; + for (int i = 0; i < d.Length; i++) + if (d[i] > tol) r++; + + return r; + } + } + /// /// Construct an eigenvalue decomposition. /// diff --git a/Sources/Accord.Math/Decompositions/EigenvalueDecompositionF.cs b/Sources/Accord.Math/Decompositions/EigenvalueDecompositionF.cs index 27542e233..6f5686538 100644 --- a/Sources/Accord.Math/Decompositions/EigenvalueDecompositionF.cs +++ b/Sources/Accord.Math/Decompositions/EigenvalueDecompositionF.cs @@ -60,6 +60,29 @@ public sealed class EigenvalueDecompositionF : ICloneable private Single[] ort; // storage for nonsymmetric algorithm. private bool symmetric; + private const Single eps = 2 * Constants.SingleEpsilon; + + + /// + /// Returns the effective numerical matrix rank. + /// + /// + /// Number of non-negligible eigen values. + /// + public int Rank + { + get + { + Single tol = n * d[0] * eps; + + int r = 0; + for (int i = 0; i < d.Length; i++) + if (d[i] > tol) r++; + + return r; + } + } + /// /// Construct an eigenvalue decomposition. /// diff --git a/Sources/Extras/Accord.Video.FFMPEG.GPL/VersionInfo.cpp b/Sources/Extras/Accord.Video.FFMPEG.GPL/VersionInfo.cpp index b192849e0..9924317a4 100644 --- a/Sources/Extras/Accord.Video.FFMPEG.GPL/VersionInfo.cpp +++ b/Sources/Extras/Accord.Video.FFMPEG.GPL/VersionInfo.cpp @@ -7,4 +7,4 @@ using namespace System::Reflection; [assembly: AssemblyCultureAttribute("")]; [assembly: AssemblyVersionAttribute("3.4.0")]; [assembly: AssemblyInformationalVersionAttribute("3.4.0")]; -[assembly: AssemblyFileVersionAttribute("3.4.0.5851")]; +[assembly: AssemblyFileVersionAttribute("3.4.0.5853")]; diff --git a/Unit Tests/Accord.Tests.MachineLearning/Clustering/TSNETest.cs b/Unit Tests/Accord.Tests.MachineLearning/Clustering/TSNETest.cs index 8f3718eae..c29ee3c9b 100644 --- a/Unit Tests/Accord.Tests.MachineLearning/Clustering/TSNETest.cs +++ b/Unit Tests/Accord.Tests.MachineLearning/Clustering/TSNETest.cs @@ -62,7 +62,12 @@ public void ConstructorTest() Assert.Fail(); } - [Test] + + [Test, +#if !DEBUG + Ignore +#endif + ] public void learn_test() { #region doc_learn