numl.Math.LinearAlgebra.Matrix.CovarianceDiag C# (CSharp) Method

CovarianceDiag() public static method

Covariance diagram.
public static CovarianceDiag ( Matrix source, VectorType t = VectorType.Col ) : Vector
source Matrix Source for the.
t VectorType (Optional) Row or Column sum.
return Vector
        public static Vector CovarianceDiag(Matrix source, VectorType t = VectorType.Col)
        {
            int length = t == VectorType.Row ? source.Rows : source.Cols;
            Vector vector = new Vector(length);
            for (int i = 0; i < length; i++)
                vector[i] = source[i, t].Variance();
            return vector;
        }

Usage Example

コード例 #1
0
 /// <summary>A Matrix extension method that covariance diagram.</summary>
 /// <param name="source">The source to act on.</param>
 /// <param name="t">(Optional) Row or Column sum.</param>
 /// <returns>A Vector.</returns>
 public static Vector CovarianceDiag(this Matrix source, VectorType t = VectorType.Col)
 {
     return(Matrix.CovarianceDiag(source, t));
 }