Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            {
                DVVector dIn  = new DVVector(new int[] { 10, 20, 30, 40, 50, 60, 70, 80 });
                DVVector dOut = new DVVector("int32_t", 8);
                TRTC.Copy(dIn, dOut);
                print_array((int[])dOut.to_host());
            }

            Functor is_even = new Functor(new string[] { "x" }, "        return x % 2 == 0;\n");

            {
                DVVector dIn   = new DVVector(new int[] { -2, 0, -1, 0, 1, 2 });
                DVVector dOut  = new DVVector("int32_t", 6);
                long     count = TRTC.Copy_If(dIn, dOut, is_even);
                print_array((int[])dOut.to_host(0, count));
            }

            {
                DVVector dIn      = new DVVector(new int[] { 0, 1, 2, 3, 4, 5 });
                DVVector dStencil = new DVVector(new int[] { -2, 0, -1, 0, 1, 2 });
                DVVector dOut     = new DVVector("int32_t", 6);
                long     count    = TRTC.Copy_If_Stencil(dIn, dStencil, dOut, is_even);
                print_array((int[])dOut.to_host(0, count));
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            {
                DVVector d_values = new DVVector(new int[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 });
                DVVector d_map    = new DVVector(new int[] { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 });
                DVVector d_output = new DVVector("int32_t", 10);
                TRTC.Gather(d_map, d_values, d_output);
                print_array((int[])d_output.to_host());
            }

            {
                DVVector d_values  = new DVVector(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
                DVVector d_stencil = new DVVector(new int[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 });
                DVVector d_map     = new DVVector(new int[] { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 });
                DVVector d_output  = new DVVector("int32_t", 10);
                TRTC.Fill(d_output, new DVInt32(7));
                TRTC.Gather_If(d_map, d_stencil, d_values, d_output);
                print_array((int[])d_output.to_host());
            }

            Functor is_even = new Functor(new string[] { "x" }, "        return ((x % 2) == 0);\n");
            {
                DVVector d_values  = new DVVector(new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 });
                DVVector d_stencil = new DVVector(new int[] { 0, 3, 4, 1, 4, 1, 2, 7, 8, 9 });
                DVVector d_map     = new DVVector(new int[] { 0, 2, 4, 6, 8, 1, 3, 5, 7, 9 });
                DVVector d_output  = new DVVector("int32_t", 10);
                TRTC.Fill(d_output, new DVInt32(7));
                TRTC.Gather_If(d_map, d_stencil, d_values, d_output, is_even);
                print_array((int[])d_output.to_host());
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            DVVector vec_to_fill = new DVVector("int32_t", 5);

            TRTC.Fill(vec_to_fill, new DVInt32(123));
            print_array((int[])vec_to_fill.to_host());
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            {
                DVVector d_values = new DVVector(new int[] { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 });
                DVVector d_map    = new DVVector(new int[] { 0, 5, 1, 6, 2, 7, 3, 8, 4, 9 });
                DVVector d_output = new DVVector("int32_t", 10);
                TRTC.Scatter(d_values, d_map, d_output);
                print_array((int[])d_output.to_host());
            }

            {
                DVVector d_V = new DVVector(new int[] { 10, 20, 30, 40, 50, 60, 70, 80 });
                DVVector d_M = new DVVector(new int[] { 0, 5, 1, 6, 2, 7, 3, 4 });
                DVVector d_S = new DVVector(new int[] { 1, 0, 1, 0, 1, 0, 1, 0 });
                DVVector d_D = new DVVector(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
                TRTC.Scatter_If(d_V, d_M, d_S, d_D);
                print_array((int[])d_D.to_host());
            }

            Functor is_even = new Functor(new string[] { "x" }, "        return ((x % 2) == 0);\n");
            {
                DVVector d_V = new DVVector(new int[] { 10, 20, 30, 40, 50, 60, 70, 80 });
                DVVector d_M = new DVVector(new int[] { 0, 5, 1, 6, 2, 7, 3, 4 });
                DVVector d_S = new DVVector(new int[] { 2, 1, 2, 1, 2, 1, 2, 1 });
                DVVector d_D = new DVVector(new int[] { 0, 0, 0, 0, 0, 0, 0, 0 });
                TRTC.Scatter_If(d_V, d_M, d_S, d_D, is_even);
                print_array((int[])d_D.to_host());
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Functor  printf_functor = new Functor(new string[] { "x" }, "        printf(\"%d\\n\", x);\n");
            DVVector vec            = new DVVector(new int[] { 1, 2, 3, 1, 2 });

            TRTC.For_Each(vec, printf_functor);
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            Functor is_less_than_zero = new Functor(new string[] { "x" }, "        return x<0;\n");

            {
                DVVector vec = new DVVector(new int[] { 1, 2, 3, 1, 2 });
                TRTC.Replace(vec, new DVInt32(1), new DVInt32(99));
                print_array((int[])vec.to_host());
            }

            {
                DVVector vec = new DVVector(new int[] { 1, -2, 3, -4, 5 });
                TRTC.Replace_If(vec, is_less_than_zero, new DVInt32(99));
                print_array((int[])vec.to_host());
            }

            {
                DVVector vec_in  = new DVVector(new int[] { 1, 2, 3, 1, 2 });
                DVVector vec_out = new DVVector("int32_t", 5);
                TRTC.Replace_Copy(vec_in, vec_out, new DVInt32(1), new DVInt32(99));
                print_array((int[])vec_out.to_host());
            }

            {
                DVVector vec_in  = new DVVector(new int[] { 1, -2, 3, -4, 5 });
                DVVector vec_out = new DVVector("int32_t", 5);
                TRTC.Replace_Copy_If(vec_in, vec_out, is_less_than_zero, new DVInt32(99));
                print_array((int[])vec_out.to_host());
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Functor  absolute_value = new Functor(new string[] { "x" }, "        return x<(decltype(x))0 ? -x : x;\n");
            DVVector d_data         = new DVVector(new int[] { -1, 0, -2, -2, 1, -3 });

            Console.WriteLine(TRTC.Transform_Reduce(d_data, absolute_value, new DVInt32(0), new Functor("Maximum")));
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            {
                DVVector darr = new DVVector(new int[] { 1, 0, 2, 2, 1, 3 });
                TRTC.Inclusive_Scan(darr, darr);
                print_array((int[])darr.to_host());
            }

            {
                DVVector darr = new DVVector(new int[] { -5, 0, 2, -3, 2, 4, 0, -1, 2, 8 });
                TRTC.Inclusive_Scan(darr, darr, new Functor("Maximum"));
                print_array((int[])darr.to_host());
            }

            {
                DVVector darr = new DVVector(new int[] { 1, 0, 2, 2, 1, 3 });
                TRTC.Exclusive_Scan(darr, darr);
                print_array((int[])darr.to_host());
            }

            {
                DVVector darr = new DVVector(new int[] { 1, 0, 2, 2, 1, 3 });
                TRTC.Exclusive_Scan(darr, darr, new DVInt32(4));
                print_array((int[])darr.to_host());
            }

            {
                DVVector darr = new DVVector(new int[] { -5, 0, 2, -3, 2, 4, 0, -1, 2, 8 });
                TRTC.Exclusive_Scan(darr, darr, new DVInt32(1), new Functor("Maximum"));
                print_array((int[])darr.to_host());
            }
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            DVVector d_data = new DVVector(new int[] { 1, 0, 2, 2, 1, 3 });

            Console.WriteLine(TRTC.Min_Element(d_data));
            Console.WriteLine(TRTC.Max_Element(d_data));
            Console.WriteLine(TRTC.MinMax_Element(d_data));
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            DVVector d_values = new DVVector(new int[] { 0, 5, 3, 7 });

            Console.WriteLine(TRTC.Find(d_values, new DVInt32(3)));
            Console.WriteLine(TRTC.Find(d_values, new DVInt32(5)));
            Console.WriteLine(TRTC.Find(d_values, new DVInt32(9)));
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            DVVector vec = new DVVector("int32_t", 10);

            TRTC.Sequence(vec);
            TRTC.Tabulate(vec, new Functor("Negate"));
            print_array((int[])vec.to_host());
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            DVCounter src = new DVCounter(new DVInt32(1), 10);
            DVVector  dst = new DVVector("int32_t", 10);

            TRTC.Copy(src, dst);
            print_array((int[])dst.to_host());
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            DVVector d_vec1 = new DVVector(new float[] { 1.0f, 2.0f, 5.0f });
            DVVector d_vec2 = new DVVector(new float[] { 4.0f, 1.0f, 5.0f });

            Console.WriteLine(TRTC.Inner_Product(d_vec1, d_vec2, new DVFloat(0.0f)));
            Console.WriteLine(TRTC.Inner_Product(d_vec1, d_vec2, new DVFloat(0.0f), new Functor("Plus"), new Functor("Multiplies")));
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            DVVector  dvalues = new DVVector(new int[] { 3, 7, 2, 5 });
            DVReverse src     = new DVReverse(dvalues);
            DVVector  dst     = new DVVector("int32_t", 4);

            TRTC.Copy(src, dst);
            print_array((int[])dst.to_host());
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            DVVector darr1 = new DVVector(new int[] { 10, 20, 30, 40, 50, 60, 70, 80 });
            DVVector darr2 = new DVVector(new int[] { 1000, 900, 800, 700, 600, 500, 400, 300 });

            TRTC.Swap(darr1, darr2);
            print_array((int[])darr1.to_host());
            print_array((int[])darr2.to_host());
        }
Ejemplo n.º 16
0
        static void Main(string[] args)
        {
            DVVector    dvalues     = new DVVector(new float[] { 1.0f, 4.0f, 9.0f, 16.0f });
            Functor     square_root = new Functor(new string[] { "x" }, "        return sqrtf(x);\n");
            DVTransform src         = new DVTransform(dvalues, "float", square_root);
            DVVector    dst         = new DVVector("float", 4);

            TRTC.Copy(src, dst);
            print_array((float[])dst.to_host());
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            TRTC.Set_Verbose();

            // just to verify that it compiles
            DVCounter src  = new DVCounter(new DVInt32(5), 10);
            DVDiscard sink = new DVDiscard("int32_t");

            TRTC.Copy(src, sink);
        }
Ejemplo n.º 18
0
        static void Main(string[] args)
        {
            DVVector      dvalues  = new DVVector(new float[] { 10.0f, 20.0f, 30.0f, 40.0f, 50.0f, 60.0f, 70.0f, 80.0f });
            DVVector      dindices = new DVVector(new int[] { 2, 6, 1, 3 });
            DVPermutation src      = new DVPermutation(dvalues, dindices);
            DVVector      dst      = new DVVector("float", 4);

            TRTC.Copy(src, dst);
            print_array((float[])dst.to_host());
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            DVVector       d_in = new DVVector(new int[] { 0, 1, 2, 3, 4 });
            DVCustomVector src  = new DVCustomVector(new DeviceViewable[] { d_in }, new string[] { "src" }, "idx",
                                                     "        return src[idx % src.size()];\n", "int32_t", d_in.size() * 5);
            DVVector dst = new DVVector("int32_t", 25);

            TRTC.Copy(src, dst);
            print_array((int[])dst.to_host());
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            DVVector vec = new DVVector("int32_t", 10);

            TRTC.Sequence(vec);
            print_array((int[])vec.to_host());

            TRTC.Sequence(vec, new DVInt32(1));
            print_array((int[])vec.to_host());

            TRTC.Sequence(vec, new DVInt32(1), new DVInt32(3));
            print_array((int[])vec.to_host());
        }
Ejemplo n.º 21
0
        static void Main(string[] args)
        {
            Functor is_even = new Functor(new string[] { "x" }, "        return x % 2 == 0;\n");

            {
                DVVector d_value = new DVVector(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
                TRTC.Partition(d_value, is_even);
                print_array((int[])d_value.to_host());
            }

            {
                DVVector d_value   = new DVVector(new int[] { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 });
                DVVector d_stencil = new DVVector(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
                TRTC.Partition_Stencil(d_value, d_stencil, is_even);
                print_array((int[])d_value.to_host());
            }

            {
                DVVector d_value = new DVVector(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
                DVVector d_evens = new DVVector("int32_t", 10);
                DVVector d_odds  = new DVVector("int32_t", 10);
                long     count   = TRTC.Partition_Copy(d_value, d_evens, d_odds, is_even);
                print_array((int[])d_evens.to_host(0, count));
                print_array((int[])d_odds.to_host(0, 10 - count));
            }

            {
                DVVector d_value   = new DVVector(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
                DVVector d_stencil = new DVVector(new int[] { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 });
                DVVector d_evens   = new DVVector("int32_t", 10);
                DVVector d_odds    = new DVVector("int32_t", 10);
                long     count     = TRTC.Partition_Copy_Stencil(d_value, d_stencil, d_evens, d_odds, new Functor("Identity"));
                print_array((int[])d_evens.to_host(0, count));
                print_array((int[])d_odds.to_host(0, 10 - count));
            }

            {
                DVVector d_value = new DVVector(new int[] { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 });
                Console.WriteLine(TRTC.Partition_Point(d_value, is_even));
            }

            {
                DVVector d_value = new DVVector(new int[] { 2, 4, 6, 8, 10, 1, 3, 5, 7, 9 });
                Console.WriteLine(TRTC.Is_Partitioned(d_value, is_even));
            }

            {
                DVVector d_value = new DVVector(new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
                Console.WriteLine(TRTC.Is_Partitioned(d_value, is_even));
            }
        }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            {
                DVVector d_data = new DVVector(new int[] { 1, 0, 2, 2, 1, 3 });
                TRTC.Transform_Inclusive_Scan(d_data, d_data, new Functor("Negate"), new Functor("Plus"));
                print_array((int[])d_data.to_host());
            }

            {
                DVVector d_data = new DVVector(new int[] { 1, 0, 2, 2, 1, 3 });
                TRTC.Transform_Exclusive_Scan(d_data, d_data, new Functor("Negate"), new DVInt32(4), new Functor("Plus"));
                print_array((int[])d_data.to_host());
            }
        }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            {
                DVVector d1 = new DVVector(new int[] { 0, 5, 3, 7 });
                DVVector d2 = new DVVector(new int[] { 0, 5, 8, 7 });
                Console.WriteLine(TRTC.Mismatch(d1, d2));
            }

            {
                DVVector d1 = new DVVector(new int[] { 0, 5, 3, 7 });
                DVVector d2 = new DVVector(new int[] { 0, 5, 8, 7 });
                Console.WriteLine(TRTC.Mismatch(d1, d2, new Functor("EqualTo")));
            }
        }
Ejemplo n.º 24
0
        static void Main(string[] args)
        {
            DVVector d_int_in   = new DVVector(new int[] { 0, 1, 2, 3, 4 });
            DVVector d_float_in = new DVVector(new float[] { 0.0f, 10.0f, 20.0f, 30.0f, 40.0f });

            DVVector d_int_out   = new DVVector("int32_t", 5);
            DVVector d_float_out = new DVVector("float", 5);

            DVZipped src = new DVZipped(new DVVectorLike[] { d_int_in, d_float_in }, new string[] { "a", "b" });
            DVZipped dst = new DVZipped(new DVVectorLike[] { d_int_out, d_float_out }, new string[] { "a", "b" });

            TRTC.Copy(src, dst);

            print_array((int[])d_int_out.to_host());
            print_array((float[])d_float_out.to_host());
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            {
                DVVector vec_in  = new DVVector(new int[] { 1, 2, 1, 2, 1, 2, 1, 2 });
                DVVector vec_out = new DVVector("int32_t", 8);
                TRTC.Adjacent_Difference(vec_in, vec_out);
                print_array((int[])vec_out.to_host());
            }

            {
                DVVector vec_in  = new DVVector(new int[] { 1, 2, 1, 2, 1, 2, 1, 2 });
                DVVector vec_out = new DVVector("int32_t", 8);
                TRTC.Adjacent_Difference(vec_in, vec_out, new Functor("Plus"));
                print_array((int[])vec_out.to_host());
            }
        }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            {
                DVVector d_value = new DVVector(new int[] { 3, 1, 4, 1, 5, 9 });
                long     count   = TRTC.Remove(d_value, new DVInt32(1));
                print_array((int[])d_value.to_host(0, count));
            }

            {
                DVVector d_in  = new DVVector(new int[] { -2, 0, -1, 0, 1, 2 });
                DVVector d_out = new DVVector("int32_t", 6);
                long     count = TRTC.Remove_Copy(d_in, d_out, new DVInt32(0));
                print_array((int[])d_out.to_host(0, count));
            }

            Functor is_even = new Functor(new string[] { "x" }, "        return x % 2 == 0;\n");

            {
                DVVector d_value = new DVVector(new int[] { 1, 4, 2, 8, 5, 7 });
                long     count   = TRTC.Remove_If(d_value, is_even);
                print_array((int[])d_value.to_host(0, count));
            }

            {
                DVVector d_in  = new DVVector(new int[] { -2, 0, -1, 0, 1, 2 });
                DVVector d_out = new DVVector("int32_t", 6);
                long     count = TRTC.Remove_Copy_If(d_in, d_out, is_even);
                print_array((int[])d_out.to_host(0, count));
            }

            Functor identity = new Functor("Identity");

            {
                DVVector d_value   = new DVVector(new int[] { 1, 4, 2, 8, 5, 7 });
                DVVector d_stencil = new DVVector(new int[] { 0, 1, 1, 1, 0, 0 });
                long     count     = TRTC.Remove_If_Stencil(d_value, d_stencil, identity);
                print_array((int[])d_value.to_host(0, count));
            }

            {
                DVVector d_in      = new DVVector(new int[] { -2, 0, -1, 0, 1, 2 });
                DVVector d_stencil = new DVVector(new int[] { 1, 1, 0, 1, 0, 1 });
                DVVector d_out     = new DVVector("int32_t", 6);
                long     count     = TRTC.Remove_Copy_If_Stencil(d_in, d_stencil, d_out, identity);
                print_array((int[])d_out.to_host(0, count));
            }
        }
Ejemplo n.º 27
0
        static void Main(string[] args)
        {
            {
                DVVector darr1 = new DVVector(new int[] { 3, 1, 4, 1, 5, 9, 3 });
                DVVector darr2 = new DVVector(new int[] { 3, 1, 4, 2, 8, 5, 7 });
                DVVector darr3 = new DVVector(new int[] { 3, 1, 4, 1, 5, 9, 3 });

                Console.WriteLine(TRTC.Equal(darr1, darr2).ToString() + " " + TRTC.Equal(darr1, darr3).ToString());
            }

            {
                Functor  compare_modulo_two = new Functor(new string[] { "x", "y" }, "        return (x % 2) == (y % 2);\n");
                DVVector dx = new DVVector(new int[] { 1, 2, 3, 4, 5, 6 });
                DVVector dy = new DVVector(new int[] { 7, 8, 9, 10, 11, 12 });
                Console.WriteLine(TRTC.Equal(dx, dy, compare_modulo_two));
            }
        }
Ejemplo n.º 28
0
        static void Main(string[] args)
        {
            int[] hin = new int[2000];
            for (int i = 0; i < 2000; i++)
            {
                hin[i] = i % 100;
            }

            DVVector din = new DVVector(hin);

            Console.WriteLine(TRTC.Count(din, new DVInt32(47)));

            TRTC.Sequence(din);
            Functor op = new Functor(new string[] { "x" }, "        return (x%100)==47;\n");

            Console.WriteLine(TRTC.Count_If(din, op));
        }
Ejemplo n.º 29
0
        static void Main(string[] args)
        {
            {
                DVVector dvalues = new DVVector(new int[] { 1, 4, 2, 8, 5, 7 });
                Console.WriteLine(TRTC.Is_Sorted(dvalues));
                TRTC.Sort(dvalues);
                print_array((int[])dvalues.to_host());
                Console.WriteLine(TRTC.Is_Sorted(dvalues));
            }

            {
                Functor  comp    = new Functor("Greater");
                DVVector dvalues = new DVVector(new int[] { 1, 4, 2, 8, 5, 7 });
                Console.WriteLine(TRTC.Is_Sorted(dvalues, comp));
                TRTC.Sort(dvalues, comp);
                print_array((int[])dvalues.to_host());
                Console.WriteLine(TRTC.Is_Sorted(dvalues, comp));
            }

            {
                DVVector dkeys   = new DVVector(new int[] { 1, 4, 2, 8, 5, 7 });
                DVVector dvalues = new DVVector(new int[] { 1, 2, 3, 4, 5, 6 });
                TRTC.Sort_By_Key(dkeys, dvalues);
                print_array((int[])dkeys.to_host());
                print_array((int[])dvalues.to_host());
            }

            {
                Functor  comp    = new Functor("Greater");
                DVVector dkeys   = new DVVector(new int[] { 1, 4, 2, 8, 5, 7 });
                DVVector dvalues = new DVVector(new int[] { 1, 2, 3, 4, 5, 6 });
                TRTC.Sort_By_Key(dkeys, dvalues, comp);
                print_array((int[])dkeys.to_host());
                print_array((int[])dvalues.to_host());
            }

            {
                DVVector dvalues = new DVVector(new int[] { 0, 1, 2, 3, 0, 1, 2, 3 });
                Console.WriteLine(TRTC.Is_Sorted_Until(dvalues));
            }

            {
                DVVector dvalues = new DVVector(new int[] { 3, 2, 1, 0, 3, 2, 1, 0 });
                Console.WriteLine(TRTC.Is_Sorted_Until(dvalues, new Functor("Greater")));
            }
        }
Ejemplo n.º 30
0
        static void Main(string[] args)
        {
            DVVector d_input = new DVVector(new int[] { 0, 2, 5, 7, 8 });

            {
                Console.WriteLine(TRTC.Lower_Bound(d_input, new DVInt32(0)));
                Console.WriteLine(TRTC.Lower_Bound(d_input, new DVInt32(1)));
                Console.WriteLine(TRTC.Lower_Bound(d_input, new DVInt32(2)));
                Console.WriteLine(TRTC.Lower_Bound(d_input, new DVInt32(3)));
                Console.WriteLine(TRTC.Lower_Bound(d_input, new DVInt32(8)));
                Console.WriteLine(TRTC.Lower_Bound(d_input, new DVInt32(9)));
            }
            Console.WriteLine("");
            {
                Console.WriteLine(TRTC.Upper_Bound(d_input, new DVInt32(0)));
                Console.WriteLine(TRTC.Upper_Bound(d_input, new DVInt32(1)));
                Console.WriteLine(TRTC.Upper_Bound(d_input, new DVInt32(2)));
                Console.WriteLine(TRTC.Upper_Bound(d_input, new DVInt32(3)));
                Console.WriteLine(TRTC.Upper_Bound(d_input, new DVInt32(8)));
                Console.WriteLine(TRTC.Upper_Bound(d_input, new DVInt32(9)));
            }
            Console.WriteLine("");
            {
                Console.WriteLine(TRTC.Binary_Search(d_input, new DVInt32(0)));
                Console.WriteLine(TRTC.Binary_Search(d_input, new DVInt32(1)));
                Console.WriteLine(TRTC.Binary_Search(d_input, new DVInt32(2)));
                Console.WriteLine(TRTC.Binary_Search(d_input, new DVInt32(3)));
                Console.WriteLine(TRTC.Binary_Search(d_input, new DVInt32(8)));
                Console.WriteLine(TRTC.Binary_Search(d_input, new DVInt32(9)));
            }
            Console.WriteLine("");

            DVVector d_values = new DVVector(new int[] { 0, 1, 2, 3, 8, 9 });
            DVVector d_output = new DVVector("int32_t", 6);

            TRTC.Lower_Bound_V(d_input, d_values, d_output);
            print_array((int[])d_output.to_host());

            TRTC.Upper_Bound_V(d_input, d_values, d_output);
            print_array((int[])d_output.to_host());

            TRTC.Binary_Search_V(d_input, d_values, d_output);
            print_array((int[])d_output.to_host());
        }