Ejemplo n.º 1
0
        public static Span256 <ulong> add(ReadOnlySpan256 <ulong> lhs, ReadOnlySpan256 <ulong> rhs, Span256 <ulong> dst)
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                vstore(dinx.add(lhs.LoadVec256(block), rhs.LoadVec256(block)), ref dst.Block(block));
            }
            return(dst);
        }
Ejemplo n.º 2
0
        public static Span256 <float> fmul(ReadOnlySpan256 <float> lhs, ReadOnlySpan256 <float> rhs, Span256 <float> dst)
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                vstore(dfp.fmul(lhs.LoadVec256(block), rhs.LoadVec256(block)), ref dst.Block(block));
            }
            return(dst);
        }
Ejemplo n.º 3
0
        public static Span256 <double> div(ReadOnlySpan256 <double> lhs, ReadOnlySpan256 <double> rhs, Span256 <double> dst)
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                vstore(dfp.div(lhs.LoadVec256(block), rhs.LoadVec256(block)), ref dst[block]);
            }
            return(dst);
        }
Ejemplo n.º 4
0
Archivo: sub.g.cs Proyecto: 0xCM/arrows
        public static Span256 <T> sub <T>(ReadOnlySpan256 <T> lhs, ReadOnlySpan256 <T> rhs, Span256 <T> dst)
            where T : struct
        {
            var blocks = dst.BlockCount;

            for (var block = 0; block < blocks; block++)
            {
                store(ginx.sub(ginx.lddqu256(in lhs.Block(block)), ginx.lddqu256(in rhs.Block(block))), ref dst.Block(block));
            }
            return(dst);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Asserts content equality for two blocked spans of primal type
 /// </summary>
 /// <param name="lhs">The left span</param>
 /// <param name="rhs">The right span</param>
 /// <param name="caller">The invoking function</param>
 /// <param name="file">The file in which the invoking function is defined </param>
 /// <param name="line">The file line number of invocation</param>
 /// <typeparam name="T">The element type</typeparam>
 public static void ClaimEqual <T>(this ReadOnlySpan256 <T> lhs, ReadOnlySpan256 <T> rhs, [Member] string caller = null, [File] string file = null, [Line] int?line = null)
     where T : struct
 {
     for (var i = 0; i < length(lhs, rhs); i++)
     {
         if (!gmath.eq(lhs[i], rhs[i]))
         {
             throw Errors.ItemsNotEqual(i, lhs[i], rhs[i], caller, file, line);
         }
     }
 }
Ejemplo n.º 6
0
        public static Span256 <T> Replicate <T>(this ReadOnlySpan256 <T> src, bool structureOnly = false)
            where T : struct
        {
            Span <T> dst = new T[src.Length];

            if (!structureOnly)
            {
                src.CopyTo(dst);
            }
            return(Z0.Span256 <T> .LoadAligned(dst));
        }
Ejemplo n.º 7
0
 public static bool Identical <T>(this ReadOnlySpan256 <T> lhs, ReadOnlySpan256 <T> rhs)
     where T : struct
 {
     for (var i = 0; i < length(lhs, rhs); i++)
     {
         if (gmath.neq(lhs[i], rhs[i]))
         {
             return(false);
         }
     }
     return(true);
 }
Ejemplo n.º 8
0
 public static Span256 <T> add <T>(ReadOnlySpan256 <T> lhs, ReadOnlySpan256 <T> rhs, Span256 <T> dst)
     where T : struct
 {
     if (typeof(T) == typeof(sbyte))
     {
         dinx.add(int8(lhs), int8(rhs), int8(dst));
     }
     else if (typeof(T) == typeof(byte))
     {
         dinx.add(uint8(lhs), uint8(rhs), uint8(dst));
     }
     else if (typeof(T) == typeof(short))
     {
         dinx.add(int16(lhs), int16(rhs), int16(dst));
     }
     else if (typeof(T) == typeof(ushort))
     {
         dinx.add(uint16(lhs), uint16(rhs), uint16(dst));
     }
     else if (typeof(T) == typeof(int))
     {
         dinx.add(int32(lhs), int32(rhs), int32(dst));
     }
     else if (typeof(T) == typeof(uint))
     {
         dinx.add(uint32(lhs), uint32(rhs), uint32(dst));
     }
     else if (typeof(T) == typeof(long))
     {
         dinx.add(int64(lhs), int64(rhs), int64(dst));
     }
     else if (typeof(T) == typeof(ulong))
     {
         dinx.add(uint64(lhs), uint64(rhs), uint64(dst));
     }
     else if (typeof(T) == typeof(float))
     {
         dfp.add(float32(lhs), float32(rhs), float32(dst));
     }
     else if (typeof(T) == typeof(double))
     {
         dfp.add(float64(lhs), float64(rhs), float64(dst));
     }
     else
     {
         throw unsupported <T>();
     }
     return(dst);
 }
Ejemplo n.º 9
0
 public static Vec256 <T> LoadVec256 <T>(this ReadOnlySpan256 <T> src, int block = 0)
     where T : unmanaged
 => Vec256.Load(src, block);
Ejemplo n.º 10
0
 public static string FormatList <T>(this ReadOnlySpan256 <T> src, char delimiter = ',', int offset = 0)
     where T : struct
 => src.Unblocked.FormatList(delimiter, offset);