As a beginner I have worked out how to get the Math.net examples to compile and run in VS2012 here Stackoverflow
For an implementation of an Echo State Network I need to calculate the spectral radius of a matrix. I think this can be achieved by taking the AbsoluteMaximum() of the EigenValues as a complex vector.
To see if this indeed works, I want use the Math.net example on factorization and eigenvalues calculation Evd.cs So I pasted the body of the example into a new console application as described above and added the required namespace.
Yet this does not compile fully. There appears to be an issue with the Eigenvectors. I get following error (multiple times): error CS0119: 'MathNet.Numerics.LinearAlgebra.Generic.Factorization.Evd<T>.EigenVectors()' is a 'method', which is not valid in the given context
This error pops up in the call: Console.WriteLine(evd.EigenVectors.ToString("#0.00\t", formatProvider)); and every other time that evd.EigenVectors is called.
What do I need to add / change to get this example to compile?
Following is a snippet of the code:
For an implementation of an Echo State Network I need to calculate the spectral radius of a matrix. I think this can be achieved by taking the AbsoluteMaximum() of the EigenValues as a complex vector.
To see if this indeed works, I want use the Math.net example on factorization and eigenvalues calculation Evd.cs So I pasted the body of the example into a new console application as described above and added the required namespace.
Yet this does not compile fully. There appears to be an issue with the Eigenvectors. I get following error (multiple times): error CS0119: 'MathNet.Numerics.LinearAlgebra.Generic.Factorization.Evd<T>.EigenVectors()' is a 'method', which is not valid in the given context
This error pops up in the call: Console.WriteLine(evd.EigenVectors.ToString("#0.00\t", formatProvider)); and every other time that evd.EigenVectors is called.
What do I need to add / change to get this example to compile?
Following is a snippet of the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Globalization; // for formatprovider
using MathNet.Numerics.LinearAlgebra.Double;
namespace MathNet_eigenvalue_demo
{
class Program
{
static void Main(string[] args)
{
// Format matrix output to console
var formatProvider = (CultureInfo)CultureInfo.InvariantCulture.Clone();
formatProvider.TextInfo.ListSeparator = " ";
// Create square symmetric matrix
var matrix = DenseMatrix.OfArray(new[,] { { 1.0, 2.0, 3.0 }, { 2.0, 1.0, 4.0 }, { 3.0, 4.0, 1.0 } });
Console.WriteLine(@"Initial square symmetric matrix");
Console.WriteLine(matrix.ToString("#0.00\t", formatProvider));
Console.WriteLine();
// Perform eigenvalue decomposition of symmetric matrix
var evd = matrix.Evd();
Console.WriteLine(@"Perform eigenvalue decomposition of symmetric matrix");
// 1. Eigen vectors
Console.WriteLine(@"1. Eigen vectors");
Console.WriteLine(evd.EigenVectors.ToString("#0.00\t", formatProvider));
Console.WriteLine();
}
}
}