public override void Step(object[] args, int stepNumber, ref object contextData)
            {
                if (args[0] == null)
                {
                    return;
                }

                byte[] arrayBytes = args[0] as byte[];
                if (arrayBytes == null || arrayBytes.Length % 8 > 0)
                {
                    throw new ArgumentException("double_array_sum only works with BLOBs of double precision floats");
                }

                int arrayLength = arrayBytes.Length / 8;

                if (stepNumber == 1)
                {
                    contextData = Enumerable.Repeat(0.0, arrayLength).ToArray();
                }

                double[] arrayValues = contextData as double[];
                ArrayCaster.AsFloatArray(arrayBytes, floats =>
                {
                    for (int i = 0; i < arrayLength; ++i)
                    {
                        arrayValues[i] += floats[i];
                    }
                });
            }
            public override object Final(object contextData)
            {
                double[] arrayValues = contextData as double[];
                if (arrayValues == null)
                    return DBNull.Value;

                byte[] result = new byte[arrayValues.Length * sizeof(double)];
                ArrayCaster.AsByteArray(arrayValues, bytes => bytes.CopyTo(result, 0));
                return result;
            }