public object Diagonal(object x) { if (x == null) { throw new ArgumentNullException(nameof(x)); } if (x is KalkMatrix m) { return(KalkMatrix.Diagonal(m)); } if (x is KalkVector v) { return(KalkVector.Diagonal(v)); } throw new ArgumentException($"Invalid argument type {Engine.GetTypeName(x)}. Expecting a matrix or a vector type.", nameof(x)); }