예제 #1
0
        public static void AddXYTran(float a, AlignedArray x, AlignedArray y,
                                     int[] starts, int[] indices, float[] coefs, int crow, float decay)
        {
            Contracts.Assert(Compat(x));
            Contracts.Assert(Compat(y));
            Contracts.Assert(0 < crow && crow <= x.Size);
            Contracts.AssertNonEmpty(starts);
            Contracts.Assert(starts.Length == crow + 1);
            Contracts.Assert(starts[0] == 0);
            Contracts.AssertNonEmpty(indices);
            Contracts.Assert(starts[crow] == indices.Length);
            Contracts.AssertNonEmpty(coefs);
            Contracts.Assert(indices.Length == coefs.Length);
            Contracts.Assert(crow * y.Size >= coefs.Length);
            Contracts.Assert(decay >= 0);

            unsafe
            {
                fixed(float *px = &x.Items[0])
                fixed(float *py     = &y.Items[0])
                fixed(int *pstarts  = &starts[0])
                fixed(int *pindices = &indices[0])
                fixed(float *pcoefs = &coefs[0])
                Thunk.AddXYTranRX(a, Ptr(x, px), Ptr(y, py), pstarts, pindices, pcoefs, crow, decay);
            }
        }