Exemplo n.º 1
0
Arquivo: or.cs Projeto: 0xCM/arrows
 public static ref BlockVector <N, T> or <N, T>(BlockVector <N, T> x, BlockVector <N, T> y, ref BlockVector <N, T> dst)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     gbitspan.or(x.Data, y.Data, dst.Data);
     return(ref dst);
 }
Exemplo n.º 2
0
Arquivo: sub.cs Projeto: 0xCM/arrows
 public static ref BlockVector <N, T> sub <N, T>(BlockVector <N, T> x, BlockVector <N, T> y, ref BlockVector <N, T> z)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     ginx.sub(x.Data, y.Data, z.Data);
     return(ref z);
 }
Exemplo n.º 3
0
Arquivo: sub.cs Projeto: 0xCM/arrows
 public static ref BlockVector <T> sub <T>(BlockVector <T> x, BlockVector <T> y, ref BlockVector <T> z)
     where T : unmanaged
 {
     mathspan.sub(x.Unblocked, y.Unblocked, z.Unblocked);
     return(ref z);
 }
Exemplo n.º 4
0
 public static Span <N, bool> eq <N, T>(BlockVector <N, T> lhs, BlockVector <N, T> rhs)
     where N : ITypeNat, new()
     where T : unmanaged
 => mathspan.eq <T>(lhs.Unsized, rhs.Unsized).ToNatural <N, bool>();
Exemplo n.º 5
0
 public static Span <bool> eq <T>(BlockVector <T> lhs, in BlockVector <T> rhs)
Exemplo n.º 6
0
 public static BlockVector <N, T> Load <N, T>(Span <T> src, N n = default)
     where N : ITypeNat, new()
     where T : struct
 => BlockVector <N, T> .LoadAligned(Span256.Load(src));
Exemplo n.º 7
0
 public static string Fomat <N, T>(this BlockVector <N, T> src)
     where T : struct
     where N : ITypeNat, new()
 => src.Unsized.FormatList();
Exemplo n.º 8
0
Arquivo: add.cs Projeto: 0xCM/arrows
 public static ref BlockVector <N, T> add <N, T>(BlockVector <N, T> x, BlockVector <N, T> y, ref BlockVector <N, T> dst)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     ginx.add(x.Data, y.Data, dst.Data);
     return(ref dst);
 }
Exemplo n.º 9
0
 public static ref BlockVector <N, T> srl <N, T>(BlockVector <N, T> src, byte offset, ref BlockVector <N, T> dst)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     gbitspan.srl(src.Data, offset, dst.Data);
     return(ref dst);
 }
Exemplo n.º 10
0
 public static void Fill <N, T>(this IPolyrand random, ref BlockVector <N, T> vector, N n = default)
     where T : struct
     where N : ITypeNat, new()
 => random.StreamTo <T>(nati <N>(), ref vector.Unsized[0]);
Exemplo n.º 11
0
Arquivo: add.cs Projeto: 0xCM/arrows
 public static ref BlockVector <N, T> add <N, T>(BlockVector <N, T> src, T scalar, ref BlockVector <N, T> dst)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     src.Data.CopyTo(dst.Data);
     mathspan.add(dst.Unsized, scalar);
     return(ref dst);
 }
Exemplo n.º 12
0
        /// <summary>
        /// Effects a component-wise contraction on the source vector on a source vector of unsigned primal type,
        /// dst[i] = src[i].Contract(max[i])
        /// </summary>
        /// <param name="src">The vector to contract</param>
        /// <param name="max">The upper bound</param>
        /// <typeparam name="N">The length type</typeparam>
        /// <typeparam name="T">The unsigned primal type</typeparam>
        public static BlockVector <N, T> Contract <N, T>(this BlockVector <N, T> src, BlockVector <N, T> max)
            where N : ITypeNat, new()
            where T : struct
        {
            var dst = NatSpan.Alloc <N, T>();

            for (var i = 0; i < dst.Length; i++)
            {
                dst[i] = Contractors.Contract(src[i], max[i]);
            }
            return(dst);
        }
Exemplo n.º 13
0
Arquivo: dot.cs Projeto: 0xCM/arrows
 public static T dot <N, T>(BlockVector <N, T> x, BlockVector <N, T> y)
     where N : ITypeNat, new()
     where T : unmanaged
 => mathspan.dot <T>(x.Unsized, y.Unsized);
Exemplo n.º 14
0
Arquivo: dot.cs Projeto: 0xCM/arrows
 public static T dot <T>(BlockVector <T> x, BlockVector <T> y)
     where T : unmanaged
 => mathspan.dot <T>(x.Unblocked, y.Unblocked);
Exemplo n.º 15
0
 public static ref BlockVector <T> div <T>(ref BlockVector <T> lhs, in BlockVector <T> rhs)
Exemplo n.º 16
0
Arquivo: and.cs Projeto: 0xCM/arrows
 public static ref BlockVector <N, T> and <N, T>(BlockVector <N, T> lhs, BlockVector <N, T> rhs, ref BlockVector <N, T> dst)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     gbitspan.and <T>(lhs.Data, rhs.Data, dst);
     return(ref dst);
 }
Exemplo n.º 17
0
 public static BlockVector <N, T> Alloc <N, T>(N n, T fill)
     where N : ITypeNat, new()
     where T : struct
 => BlockVector <N, T> .LoadAligned(Span256.Alloc <N, T>(fill));
Exemplo n.º 18
0
Arquivo: and.cs Projeto: 0xCM/arrows
 public static ref BlockVector <N, T> and <N, T>(BlockVector <N, T> lhs, T rhs, ref BlockVector <N, T> dst)
     where N : ITypeNat, new()
     where T : unmanaged
 {
     lhs.Data.CopyTo(dst.Data);
     gbitspan.and(dst.Data, rhs);
     return(ref dst);
 }
Exemplo n.º 19
0
 public static BlockVector <N, T> Load <N, T>(N length, params T[] src)
     where N : ITypeNat, new()
     where T : struct
 => BlockVector <N, T> .LoadAligned(Span256.Load <T>(src));
Exemplo n.º 20
0
 public static ref BlockVector <T> negate <T>(ref BlockVector <T> src)
     where T : unmanaged
 {
     mathspan.negate(src.Unblocked);
     return(ref src);
 }