/// <summary> /// Returns the p-distance between two matrices. /// </summary> public static __ctype__ Distance(__nmtype__ a, __nmtype__ b, __ctype__ p) { return(( /*# n.ForEach(i => { m.ForEach(j => { */ Fun.Abs(b.M__i____j__ - a.M__i____j__).Pow(p) /*# }, add); }, add); */ ).Pow(1 / p)); }
/// <summary> /// Returns the p-norm of the matrix. This is calculated as /// (|M00|^p + |M01|^p + ... )^(1/p) /// </summary> public __ctype__ Norm(__ctype__ p) { return(( /*# n.ForEach(i => { m.ForEach(j => { */ Fun.Abs(M__i____j__).Pow(p) /*# }, add); }, add); */ ).Pow(1 / p)); }