Пример #1
0
        static Vec128 <T> CalcUnits()
        {
            var n   = Length;
            var dst = Span128.Alloc <T>(n);
            var one = gmath.one <T>();

            for (var i = 0; i < n; i++)
            {
                dst[i] = one;
            }
            return(Vec128.Load(dst));
        }
Пример #2
0
        /// <summary>
        /// Creates a vector with incrementing components
        /// v[0] = first and v[i+1] = v[i] + 1 for i=1...N-1
        /// </summary>
        /// <param name="first">The value of the first component</param>
        /// <typeparam name="T">The primal component type</typeparam>
        public static Vec128 <T> Increments(T first = default, params Swap[] swaps)
        {
            var n   = Length;
            var dst = Span128.Alloc <T>(n);
            var val = first;

            for (var i = 0; i < n; i++)
            {
                dst[i] = val;
                gmath.inc(ref val);
            }
            return(Vec128.Load(dst.Swap(swaps)));
        }