// Copy the current object contents into the output. Only copy selected entries,
        // as indicated by selectedInUse and the sel array.
        public void copySelected(bool selectedInUse, int[] sel, int size, DoubleColumnVector output)
        {
            // Output has nulls if and only if input has nulls.
            output.noNulls     = noNulls;
            output.isRepeating = false;

            // Handle repeating case
            if (isRepeating)
            {
                output.vector[0]   = vector[0]; // automatic conversion to double is done here
                output.isNull[0]   = isNull[0];
                output.isRepeating = true;
                return;
            }

            // Handle normal case

            // Copy data values over
            if (selectedInUse)
            {
                for (int j = 0; j < size; j++)
                {
                    int i = sel[j];
                    output.vector[i] = vector[i];
                }
            }
            else
            {
                for (int i = 0; i < size; ++i)
                {
                    output.vector[i] = vector[i];
                }
            }

            // Copy nulls over if needed
            if (!noNulls)
            {
                if (selectedInUse)
                {
                    for (int j = 0; j < size; j++)
                    {
                        int i = sel[j];
                        output.isNull[i] = isNull[i];
                    }
                }
                else
                {
                    Array.Copy(isNull, 0, output.isNull, 0, size);
                }
            }
        }
        // Copy the current object contents into the output. Only copy selected entries,
        // as indicated by selectedInUse and the sel array.
        public void copySelected(bool selectedInUse, int[] sel, int size, DoubleColumnVector output)
        {
            // Output has nulls if and only if input has nulls.
            output.noNulls = noNulls;
            output.isRepeating = false;

            // Handle repeating case
            if (isRepeating)
            {
                output.vector[0] = vector[0];
                output.isNull[0] = isNull[0];
                output.isRepeating = true;
                return;
            }

            // Handle normal case

            // Copy data values over
            if (selectedInUse)
            {
                for (int j = 0; j < size; j++)
                {
                    int i = sel[j];
                    output.vector[i] = vector[i];
                }
            }
            else
            {
                Array.Copy(vector, 0, output.vector, 0, size);
            }

            // Copy nulls over if needed
            if (!noNulls)
            {
                if (selectedInUse)
                {
                    for (int j = 0; j < size; j++)
                    {
                        int i = sel[j];
                        output.isNull[i] = isNull[i];
                    }
                }
                else
                {
                    Array.Copy(isNull, 0, output.isNull, 0, size);
                }
            }
        }