예제 #1
0
        public static float DotProductSparse(ReadOnlySpan <float> a, ReadOnlySpan <float> b, ReadOnlySpan <int> indices, int count)
        {
            Contracts.AssertNonEmpty(a);
            Contracts.AssertNonEmpty(b);
            Contracts.Assert(0 < count);
            Contracts.Assert(count < a.Length);
            Contracts.Assert(count <= b.Length);
            Contracts.Assert(count <= indices.Length);

            unsafe
            {
                fixed(float *pa = &MemoryMarshal.GetReference(a))
                fixed(float *pb = &MemoryMarshal.GetReference(b))
                fixed(int *pi   = &MemoryMarshal.GetReference(indices))
                return(Thunk.DotSU(pa, pb, pi, count));
            }
        }
예제 #2
0
        public static float DotProductSparse(float[] a, float[] b, int[] indices, int count)
        {
            Contracts.AssertNonEmpty(a);
            Contracts.AssertNonEmpty(b);
            Contracts.Assert(0 < count);
            Contracts.Assert(count < a.Length);
            Contracts.Assert(count <= b.Length);
            Contracts.Assert(count <= indices.Length);

            unsafe
            {
                fixed(float *pa = &a[0])
                fixed(float *pb = &b[0])
                fixed(int *pi   = &indices[0])
                return(Thunk.DotSU(pa, pb, pi, count));
            }
        }