Esempio n. 1
0
        public static string ToStringInShortFormat(this NDArray array, bool includeHeader)
        {
            var dtype = DType.GetType(array.GetDType());

            if (dtype == DType.Float64)
            {
                return(ToStringInShortFormat <double>(array, includeHeader));
            }
            if (dtype == DType.Float32)
            {
                return(ToStringInShortFormat <float>(array, includeHeader));
            }
            if (dtype == DType.Int64)
            {
                return(ToStringInShortFormat <long>(array, includeHeader));
            }
            if (dtype == DType.Int32)
            {
                return(ToStringInShortFormat <int>(array, includeHeader));
            }
            if (dtype == DType.Int8)
            {
                return(ToStringInShortFormat <sbyte>(array, includeHeader));
            }
            if (dtype == DType.UInt8)
            {
                return(ToStringInShortFormat <byte>(array, includeHeader));
            }

            throw new ArgumentException($"Type {dtype} cannot be displayed");
        }