public static DoubleMatrix Decompose(
	ReadOnlyDoubleMatrix matrix,
	bool lowerTriangularPart,
	out DoubleMatrix eigenvectors
)Public Shared Function Decompose ( 
	matrix As ReadOnlyDoubleMatrix,
	lowerTriangularPart As Boolean,
	<OutAttribute> ByRef eigenvectors As DoubleMatrix
) As DoubleMatrixpublic:
static DoubleMatrix^ Decompose(
	ReadOnlyDoubleMatrix^ matrix, 
	bool lowerTriangularPart, 
	[OutAttribute] DoubleMatrix^% eigenvectors
)static member Decompose : 
        matrix : ReadOnlyDoubleMatrix * 
        lowerTriangularPart : bool * 
        eigenvectors : DoubleMatrix byref -> DoubleMatrix In the following example, the spectral decomposition of a matrix is computed.
using System;
using Novacta.Analytics.Advanced;
namespace Novacta.Analytics.CodeExamples.Advanced
{
    public class SpectralDecompositionExample0  
    {
        public void Main()
        {
            // Create a matrix containing the
            // lower triangular part of the symmetric matrix
            // to be decomposed.
            var data = new double[9] {
                2,
                2,
                0,
                0,
                0,
                0,
                1,
                0,
                5
            };
            var matrix = DoubleMatrix.Dense(3, 3, data);
            // Set the relevant triangular part.
            bool lowerTriangularPart = true;
            Console.WriteLine("Matrix to be decomposed:");
            Console.WriteLine(DoubleMatrix.Dense(3, 3, [
                2,
                2,
                0,
                2,
                0,
                0,
                0,
                0,
                5
            ]));
            // Compute the Spectral decomposition.
            var eigenvalues = SpectralDecomposition.Decompose(
                matrix,
                lowerTriangularPart,
                out DoubleMatrix eigenvectors);
            Console.WriteLine();
            Console.WriteLine("Eigenvalues:");
            Console.WriteLine(eigenvalues);
            Console.WriteLine();
            Console.WriteLine("Eigenvectors:");
            Console.WriteLine(eigenvectors);
            Console.WriteLine();
            Console.WriteLine("Matrix reconstruction:");
            var l = eigenvalues;
            var v = eigenvectors;
            Console.WriteLine(v * l * v.Transpose());
        }
    }
}
// Executing method Main() produces the following output:
// 
// Matrix to be decomposed:
// 2                2                0                
// 2                0                0                
// 0                0                5                
// 
// 
// 
// Eigenvalues:
// -1.23606798      0                0                
// 0                3.23606798       0                
// 0                0                5                
// 
// 
// 
// Eigenvectors:
// 0.525731112      -0.850650808     0                
// -0.850650808     -0.525731112     0                
// 0                0                1                
// 
// 
// 
// Matrix reconstruction:
// 2                2                0                
// 2                -1.11022302e-16  0                
// 0                0                5                
// 
//| ArgumentNullException | matrix is null. | 
| ArgumentException | matrix is not square. |