/// <summary> /// Returns the matrix's fraction of non-zero cells; <i>A.cardinality() / A.Count</i>. /// </summary> /// <param name="A"></param> /// <returns></returns> public static double Density(DoubleMatrix2D A) { return(A.Cardinality() / (double)A.Size); }