public static CovarianceDiag ( Matrix source, VectorType t = VectorType.Col ) : |
||
source | Matrix | Source for the. |
t | VectorType | (Optional) Row or Column sum. |
return |
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;
}
/// <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)); }