Covariance() public static method

Covariances.
public static Covariance ( Matrix source, VectorType t = VectorType.Col ) : Matrix
source Matrix Source for the.
t VectorType (Optional) Row or Column sum.
return Matrix
Example #1
0
        /// <summary>Generates.</summary>
        /// <param name="matrix">The matrix.</param>
        public void Generate(Matrix matrix)
        {
            // generate centered matrix
            // (using a copy since centering is in place)
            X = matrix
                    .Copy()
                    .Center(VectorType.Col);

            // compute eigen-decomposition
            // of covariance matrix
            var eigs = X.Covariance().Eigs();
            Eigenvalues = eigs.Item1;
            Eigenvectors = eigs.Item2;
        }
Example #2
0
 /// <summary>A Matrix extension method that covariances.</summary>
 /// <param name="source">The source to act on.</param>
 /// <param name="t">(Optional) Row or Column sum.</param>
 /// <returns>A Matrix.</returns>
 public static Matrix Covariance(this Matrix source, VectorType t = VectorType.Col)
 {
     return(Matrix.Covariance(source, t));
 }