Example #1
0
        /// <summary>
        /// Creates a vector populated with component values that alternate between the first operand and the second
        /// </summary>
        /// <param name="a">The first operand</param>
        /// <param name="b">The second operand</param>
        /// <typeparam name="T">The primal component type</typeparam>
        public static Vec256 <T> Alternate <T>(T a, T b)
            where T : unmanaged
        {
            var n   = Vec256 <T> .Length;
            var dst = Span256.AllocBlock <T>();

            for (var i = 0; i < n; i++)
            {
                dst[i] = even(i) ? a : b;
            }
            return(Vec256.Load(ref head(dst)));
        }