예제 #1
0
    public static void Set <T>(this T[,,,] array, Index4D index, T value)
    {
        Contracts.Requires.That(array != null);
        Contracts.Requires.That(array.IsIndexValid(index));

        array[index.X, index.Y, index.Z, index.W] = value;
    }
예제 #2
0
    public static T Get <T>(this T[,,,] array, Index4D index)
    {
        Contracts.Requires.That(array != null);
        Contracts.Requires.That(array.IsIndexValid(index));

        return(array[index.X, index.Y, index.Z, index.W]);
    }
예제 #3
0
        public static T[][][][] ConvertToJaggedArray4 <T>(T[, , ,] multiArray)
        {
            int firstElement  = multiArray.GetLength(0);
            int secondElement = multiArray.GetLength(1);
            int thirdElement  = multiArray.GetLength(2);
            int fourthElement = multiArray.GetLength(3);

            T[][][][] jaggedArray = new T[firstElement][][][];

            for (int c = 0; c < firstElement; c++)
            {
                jaggedArray[c] = new T[secondElement][][];
                for (int r = 0; r < secondElement; r++)
                {
                    jaggedArray[c][r] = new T[thirdElement][];
                    for (int p = 0; p < thirdElement; p++)
                    {
                        jaggedArray[c][r][p] = new T[fourthElement];
                        for (int q = 0; q < fourthElement; q++)
                        {
                            jaggedArray[c][r][p][q] = multiArray[c, r, p, q];
                        }
                    }
                }
            }
            return(jaggedArray);
        }
예제 #4
0
        public int Serialize(ref byte[] bytes, int offset, T[,,,] value, IFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                return(MessagePackBinary.WriteNil(ref bytes, offset));
            }
            else
            {
                var i = value.GetLength(0);
                var j = value.GetLength(1);
                var k = value.GetLength(2);
                var l = value.GetLength(3);

                var startOffset = offset;
                var formatter   = formatterResolver.GetFormatterWithVerify <T>();

                offset += MessagePackBinary.WriteArrayHeader(ref bytes, offset, ArrayLength);
                offset += MessagePackBinary.WriteInt32(ref bytes, offset, i);
                offset += MessagePackBinary.WriteInt32(ref bytes, offset, j);
                offset += MessagePackBinary.WriteInt32(ref bytes, offset, k);
                offset += MessagePackBinary.WriteInt32(ref bytes, offset, l);

                offset += MessagePackBinary.WriteArrayHeader(ref bytes, offset, value.Length);
                foreach (var item in value)
                {
                    offset += formatter.Serialize(ref bytes, offset, item, formatterResolver);
                }

                return(offset - startOffset);
            }
        }
예제 #5
0
        /// <summary>
        /// Converts a 4 dimensional dataSet to a 3 dimensional dataSet
        /// </summary>
        /// <param name="dataSet">The dataSet to fold</param>
        /// <param name="day">The day to focus</param>
        /// <returns></returns>
        public T[, ,] ConvertTo3D(T[, , ,] dataSet, int dayofmonth)
        {
            if (dayofmonth < 0 || dayofmonth > DateUtility.DaysInMonth(monthInReview, yearInReview))
            {
                throw new ArgumentOutOfRangeException("dayofmonth", "Cannot be less than 0 or greater than " + DateUtility.DaysInMonth(monthInReview, yearInReview));
            }
            if (dayofmonth > 0)
            {
                dayofmonth--;
            }
            //A 3d matrix of only days and hours and minutes
            T[, ,] dMatrix = new T[1, 24, 60];
            T MinuteTotal;

            for (int Hour = 0; Hour < 24; Hour++)
            {
                for (int Minute = 0; Minute < 60; Minute++)
                {
                    MinuteTotal = default(T);
                    for (int Second = 0; Second < 60; Second++)
                    {
                        MinuteTotal = Operator.Add(MinuteTotal, dataSet[dayofmonth, Hour, Minute, Second]);
                    }
                    dMatrix[0, Hour, Minute] = Operator.DivideInt32(MinuteTotal, 60);//seconds in a minute
                }//Minutes
            }//Hours
            return(dMatrix);
        }
예제 #6
0
        /// <summary>
        /// Handles the array resizing if necessary when an index is accessed.
        /// </summary>
        /// <param name="index">The index being accessed.</param>
        /// <returns>The adjusted index to be used for accessing the backing array.</returns>
        private Index4D HandleArrayResizing(Index4D index)
        {
            int x = index.X;
            int y = index.Y;
            int z = index.Z;
            int w = index.W;

            if (this.IsIndexInCurrentBounds(index))
            {
                x += this.xOrigin;
                y += this.yOrigin;
                z += this.zOrigin;
                w += this.wOrigin;
                return(new Index4D(x, y, z, w));
            }

            // determine size of new array
            int xOffset, yOffset, zOffset, wOffset;
            int xNewSize = DynamicArrayUtilities.HandleAxis(this.GetCurrentLength(Axis4D.X), ref x, ref this.xOrigin, out xOffset);
            int yNewSize = DynamicArrayUtilities.HandleAxis(this.GetCurrentLength(Axis4D.Y), ref y, ref this.yOrigin, out yOffset);
            int zNewSize = DynamicArrayUtilities.HandleAxis(this.GetCurrentLength(Axis4D.Z), ref z, ref this.zOrigin, out zOffset);
            int wNewSize = DynamicArrayUtilities.HandleAxis(this.GetCurrentLength(Axis4D.W), ref w, ref this.wOrigin, out wOffset);

            // copy old array into new array
            T[,,,] newArray = new T[xNewSize, yNewSize, zNewSize, wNewSize];
            foreach (KeyValuePair <Index4D, T> pair in this.array.GetIndexValuePairs())
            {
                newArray[pair.Key.X + xOffset, pair.Key.Y + yOffset, pair.Key.Z + zOffset, pair.Key.W + wOffset] = pair.Value;
            }

            this.array = newArray;
            return(new Index4D(x, y, z, w));
        }
예제 #7
0
        public void Serialize(ref MessagePackWriter writer, ref int idx, T[,,,] value, IFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNil(ref idx); return;
            }

            var i = value.GetLength(0);
            var j = value.GetLength(1);
            var k = value.GetLength(2);
            var l = value.GetLength(3);

            var formatter = formatterResolver.GetFormatterWithVerify <T>();

            writer.WriteFixedArrayHeaderUnsafe(ArrayLength, ref idx);
            writer.WriteInt32(i, ref idx);
            writer.WriteInt32(j, ref idx);
            writer.WriteInt32(k, ref idx);
            writer.WriteInt32(l, ref idx);

            writer.WriteArrayHeader(value.Length, ref idx);
            foreach (var item in value)
            {
                formatter.Serialize(ref writer, ref idx, item, formatterResolver);
            }
        }
예제 #8
0
 public static void ForEach <T>(this T[,,,] array, Action <T> action)
 {
     foreach (var item in array)
     {
         action.Invoke(item);
     }
 }
        public void Serialize(NetDataWriter writer, T[,,,] value, NetDataSerializerOptions options)
        {
            if (value == null)
            {
                writer.Write(false);
            }
            else
            {
                writer.Write(true);

                var i = value.GetLength(0);
                var j = value.GetLength(1);
                var k = value.GetLength(2);
                var l = value.GetLength(3);

                INetDataFormatter <T> formatter = options.Resolver.GetFormatter <T>();

                writer.Write(ArrayLength);
                writer.Write(i);
                writer.Write(j);
                writer.Write(k);
                writer.Write(l);

                writer.Write(value.Length);
                foreach (T item in value)
                {
                    formatter.Serialize(writer, item, options);
                }
            }
        }
        public void Serialize(ref MessagePackWriter writer, T[,,,] value, MessagePackSerializerOptions options)
        {
            if (value == null)
            {
                writer.WriteNil();
            }
            else
            {
                var i = value.GetLength(0);
                var j = value.GetLength(1);
                var k = value.GetLength(2);
                var l = value.GetLength(3);

                IMessagePackFormatter <T> formatter = options.Resolver.GetFormatterWithVerify <T>();

                writer.WriteArrayHeader(ArrayLength);
                writer.Write(i);
                writer.Write(j);
                writer.Write(k);
                writer.Write(l);

                writer.WriteArrayHeader(value.Length);
                foreach (T item in value)
                {
                    writer.CancellationToken.ThrowIfCancellationRequested();
                    formatter.Serialize(ref writer, item, options);
                }
            }
        }
예제 #11
0
        protected Grid4D(int width, int height, int depth, int depthW, T defaultValue, bool initializeValueCounters)
        {
            Values = new T[Width = width, Height = height, Depth = depth, DepthW = depthW];
            if (!defaultValue.Equals(default(T)))
            {
                for (int x = 0; x < width; x++)
                {
                    for (int y = 0; y < height; y++)
                    {
                        for (int z = 0; z < depth; z++)
                        {
                            for (int w = 0; w < depthW; w++)
                            {
                                Values[x, y, z, w] = defaultValue;
                            }
                        }
                    }
                }
            }

            if (initializeValueCounters)
            {
                ValueCounters = new();
                ValueCounters.Add(defaultValue, width * height * depth);
            }
        }
예제 #12
0
        internal void AssertArray <T>(ndarray arrayData, T[,,,] expectedData)
        {
            int lengthd0 = expectedData.GetLength(0);
            int lengthd1 = expectedData.GetLength(1);
            int lengthd2 = expectedData.GetLength(2);
            int lengthd3 = expectedData.GetLength(3);

            AssertShape(arrayData, lengthd0, lengthd1, lengthd2, lengthd3);
            AssertDataTypes(arrayData, expectedData);

            for (int i = 0; i < lengthd0; i++)
            {
                ndarray dim1Data = arrayData[i] as ndarray;
                for (int j = 0; j < lengthd1; j++)
                {
                    ndarray dim2Data = dim1Data[j] as ndarray;
                    for (int k = 0; k < lengthd2; k++)
                    {
                        ndarray dim3Data = dim2Data[k] as ndarray;
                        for (int l = 0; l < lengthd3; l++)
                        {
                            T E1 = expectedData[i, j, k, l];
                            T A1 = (T)dim3Data[l];

                            Assert.AreEqual(E1, A1);
                        }
                    }
                }
            }
        }
예제 #13
0
 /// <summary>
 /// Adds a 4 dimensional dataSet to the DateMatrix
 /// </summary>
 /// <param name="key">The key the dataSet should be stored under</param>
 /// <param name="value">The 4 dimensional dataSet to store</param>
 public void AddDataSet(string key, T[, , ,] value)
 {
     lock (SyncRoot)
     {
         dataDictionary.Add(key, value);
     }
 }
예제 #14
0
        private static ByReference <T> InternalAddress(T[,,,] array, int index1, int index2, int index3, int index4)
        {
            MDArrayRank4 <T> mdArrayObj = Unsafe.As <MDArrayRank4 <T> >(array);

            if ((index1 < 0) || (index1 >= mdArrayObj._upperBound1))
            {
                throw new IndexOutOfRangeException();
            }
            if ((index2 < 0) || (index2 >= mdArrayObj._upperBound2))
            {
                throw new IndexOutOfRangeException();
            }
            if ((index3 < 0) || (index3 >= mdArrayObj._upperBound3))
            {
                throw new IndexOutOfRangeException();
            }
            if ((index4 < 0) || (index4 >= mdArrayObj._upperBound4))
            {
                throw new IndexOutOfRangeException();
            }

            int index = (((((index1 * mdArrayObj._upperBound2) + index2) * mdArrayObj._upperBound3) + index3) * mdArrayObj._upperBound4) + index4;


            int offset = ByReference <T> .SizeOfT() * index + 4 * 8;

            ByReference <int> _upperBound1Ref = ByReference <int> .FromRef(ref mdArrayObj._upperBound1);

            return(ByReference <int> .Cast <T>(ByReference <int> .AddRaw(_upperBound1Ref, offset)));
        }
예제 #15
0
        /// <summary>
        /// Converts a 4 dimensional dataSet to a 3 dimensional dataSet
        /// </summary>
        /// <param name="dataSet">The dataSet to fold</param>
        /// <param name="day">The day to focus</param>
        /// <returns></returns>
        public T[, ,] ConvertTo3D(T[, , ,] dataSet, DayOfWeek day)
        {
            DateTime refrencePoint = DateTime.MinValue;
            int      ZeroData      = 0;

            //A 3d matrix of only days and hours and minutes
            T[, ,] dMatrix = new T[1, 24, 60];
            T   MinuteTotal = default(T);
            int dayBound    = dataSet.GetUpperBound(0) + 1;

            for (int Day = 0; Day < dayBound; Day++)
            {
                try
                {
                    refrencePoint = new DateTime(yearInReview, monthInReview, Day + 1);
                }
                catch      //if this is invalid date
                {
                    break; //stop the loop
                }
                if (refrencePoint.DayOfWeek != day)
                {
                    continue;
                }
                for (int Hour = 0; Hour < 24; Hour++)
                {
                    for (int Minute = 0; Minute < 60; Minute++)
                    {
                        ZeroData    = 0;
                        MinuteTotal = default(T);
                        for (int Second = 0; Second < 60; Second++)
                        {
                            if (Operator.IsDefault(dataSet[Day, Hour, Minute, Second]))
                            {
                                ZeroData++;
                            }
                            MinuteTotal = Operator.Add(MinuteTotal, dataSet[Day, Hour, Minute, Second]);
                        }
                        int Correction = 60 - ZeroData;
                        int DayOccurs  = DateUtility.OccurancesOfDayInMonth(day, monthInReview, yearInReview);

                        if (!Operator.IsDefault(MinuteTotal))
                        {
                            MinuteTotal = Operator.DivideInt32(MinuteTotal, 60);
                        }

                        if (Correction < DayOccurs * 2 && Correction != 0)
                        {
                            //dMatrix[0, Hour, Minute] = GenericMath.AddChecked(MinuteTotal, GenericMath.Multiply(GenericMath.Divide(MinuteTotal, Correction), GenericMath.SubtractChecked(GenericMath.Multiply(DayOccurs, 2), Correction)));
                            dMatrix[0, Hour, Minute] = Operator.Add(MinuteTotal, Operator.MultiplyInt32(Operator.DivideInt32(MinuteTotal, Correction), Operator.Subtract(Operator.MultiplyInt32(DayOccurs, 2), Correction)));
                        }
                        else
                        {
                            dMatrix[0, Hour, Minute] = MinuteTotal;
                        }
                    } //Minutes
                }     //Hours
            }
            return(dMatrix);
        }
예제 #16
0
        /// <summary>
        /// Converts a 4 dimensional dataSet to a 3 dimensional dataSet
        /// </summary>
        /// <param name="dataSet">The dataSet to fold</param>
        /// <returns></returns>
        public T[, ,] ConvertTo3D(T[, , ,] dataSet)
        {
            //A 3d matrix of only days and hours and minutes
            T[, ,] dMatrix = new T[7, 24, 60];
            T MinuteTotal = default(T);

            for (int Day = 0, dayEnd = dataSet.GetUpperBound(0) + 1, dayInMonth = DateUtility.DaysInMonth(monthInReview, yearInReview); (Day < dayEnd && Day < dayInMonth); Day++)
            {
                for (int Hour = 0, hourEnd = dataSet.GetUpperBound(1) + 1; Hour < hourEnd; Hour++)
                {
                    for (int Minute = 0, minuteEnd = dataSet.GetUpperBound(2) + 1; Minute < minuteEnd; Minute++)
                    {
                        MinuteTotal = default(T);
                        for (int Second = 0, secondEnd = dataSet.GetUpperBound(3) + 1; Second < secondEnd; Second++)
                        {
                            MinuteTotal = Operator.Add(MinuteTotal, dataSet[Day, Hour, Minute, Second]);
                        }
                        DateTime checker = new DateTime(yearInReview, monthInReview, Day + 1, Hour, Minute, 0);

                        dMatrix[(int)checker.DayOfWeek, Hour, Minute] = MinuteTotal;
                    } //Minutes
                }     //Hours
            }         //Days
            return(dMatrix);
        }
예제 #17
0
        /// <summary>
        /// Returns an inverted matrix by finding values which are equal to 0 and setting them to 1
        /// and values greater then 0 and setting them to 0
        /// </summary>
        /// <param name="dataSet">The 4 dimensional dataSet to invert</param>
        /// <returns></returns>
        public int[, , ,] GetMissingDataFromDataSet(T[, , ,] dataSet)
        {
            int dayEnd    = dataSet.GetUpperBound(0) + 1,
                monthEnd  = DateUtility.DaysInMonth(monthInReview, yearInReview),
                hourEnd   = dataSet.GetUpperBound(1) + 1,
                minuteEnd = dataSet.GetUpperBound(2) + 1,
                secondEnd = dataSet.GetUpperBound(3) + 1;

            int[, , ,] data = new int[dayEnd, hourEnd, minuteEnd, secondEnd];

            for (int day = 0; (day < dayEnd && day < monthEnd); day++)
            {
                for (int hour = 0; hour < hourEnd; hour++)
                {
                    for (int minute = 0; minute < minuteEnd; minute++)
                    {
                        for (int second = 0; second < secondEnd; second++)
                        {
                            if (Operator.IsDefault(dataSet[day, hour, minute, second]))
                            {
                                data[day, hour, minute, second] = 1;
                            }
                            else
                            {
                                data[day, hour, minute, second] = 0;
                            }
                        }
                    }
                }
            }
            return(data);
        }
예제 #18
0
        public void Serialize(ref MessagePackWriter writer, T[,,,] value, IFormatterResolver resolver)
        {
            if (value == null)
            {
                writer.WriteNil();
            }
            else
            {
                var i = value.GetLength(0);
                var j = value.GetLength(1);
                var k = value.GetLength(2);
                var l = value.GetLength(3);

                var formatter = resolver.GetFormatterWithVerify <T>();

                writer.WriteArrayHeader(ArrayLength);
                writer.Write(i);
                writer.Write(j);
                writer.Write(k);
                writer.Write(l);

                writer.WriteArrayHeader(value.Length);
                foreach (var item in value)
                {
                    formatter.Serialize(ref writer, item, resolver);
                }
            }
        }
예제 #19
0
파일: Marshal.cs 프로젝트: mi1vus/PCSC_lib
            /// <summary>
            /// Перевод четырехмерного массива в одномерный
            /// </summary>
            /// <typeparam name="T">Тип исходного массива</typeparam>
            /// <param name="array">Исходный массив</param>
            /// <returns>Одномерный массив</returns>
            public static T[] ToRank1(T[,,,] array, int x, int y, int z, int w)
            {
                T[] res  = new T[x * y * z * w];
                int size = Buffer.ByteLength(array);

                Buffer.BlockCopy(array, 0, res, 0, size);
                return(res);
            }
예제 #20
0
 public static NDArray array <T>(T[,,,] data) where T : unmanaged
 {
     if (data == null)
     {
         throw new ArgumentNullException(nameof(data));
     }
     return(new NDArray(ArraySlice.FromArray(data.Cast <T>().ToArray()), new Shape(data.GetLength(0), data.GetLength(1), data.GetLength(2), data.GetLength(3))));
 }
예제 #21
0
 public AddThreaded(int start, int count, ref DataSet dataSet, ref string dateTimeField, ref string dataField, ref T [, , ,] data)
 {
     this.start         = start;
     this.count         = count;
     this.dataSet       = dataSet;
     this.dateTimeField = dateTimeField;
     this.dataField     = dataField;
     this.data          = data;
 }
예제 #22
0
        private void AssertDataTypes <T>(ndarray arrayData, T[,,,] expectedData)
        {
            if (expectedData[0, 0, 0, 0] == null)
            {
                return;
            }

            Assert.IsInstanceOfType(arrayData.GetItem(0), expectedData[0, 0, 0, 0].GetType(), "ndarray type is not a match for expectedData");
        }
예제 #23
0
        public static void Set(T[,,,] array, int index1, int index2, int index3, int index4, T value)
        {
            if (!typeof(T).TypeHandle.ToEETypePtr().IsValueType)
            {
                RuntimeImports.RhCheckArrayStore(array, (object)value);
            }

            ByReference <T> .Store(InternalAddress(array, index1, index2, index3, index4), value);
        }
예제 #24
0
    /// <summary>
    /// Gets an enumerable sequence of all the indices along with their associated values of an array.
    /// </summary>
    /// <typeparam name="T">The type of values stored in the array.</typeparam>
    /// <param name="array">The array.</param>
    /// <returns>The enumerable sequence of indices paired with their values.</returns>
    public static IEnumerable <KeyValuePair <Index4D, T> > GetIndexValuePairs <T>(this T[,,,] array)
    {
        Contracts.Requires.That(array != null);

        foreach (var index in Index.Range(array.GetLowerBounds(), array.GetDimensions()))
        {
            yield return(new KeyValuePair <Index4D, T>(index, array[index.X, index.Y, index.Z, index.W]));
        }
    }
예제 #25
0
        public static NDarray <T> array <T>(T[,,,] data, Dtype dtype = null, bool?copy = null, string order = null, bool?subok = null, int?ndmin = null) where T : struct
        {
            var __self__ = self;
            var d1_array = data.Cast <T>().ToArray();
            var shape    = new Shape(data.GetLength(0), data.GetLength(1), data.GetLength(2), data.GetLength(3));
            var ndarray  = array <T>(d1_array, dtype, copy, order, subok, ndmin);

            return(new NDarray <T>(ndarray.reshape(shape)));
        }
예제 #26
0
    /// <summary>
    /// Gets an enumerable sequence of all the indices of an array.
    /// </summary>
    /// <typeparam name="T">The type of values stored in the array.</typeparam>
    /// <param name="array">The array.</param>
    /// <returns>The enumerable sequence of indices.</returns>
    public static IEnumerable <Index4D> GetIndices <T>(this T[,,,] array)
    {
        Contracts.Requires.That(array != null);

        foreach (var index in Index.Range(array.GetLowerBounds(), array.GetDimensions()))
        {
            yield return(index);
        }
    }
예제 #27
0
    /// <summary>
    /// Gets the dimensions of an array.
    /// </summary>
    /// <typeparam name="T">The type of values stored in the array.</typeparam>
    /// <param name="array">The array.</param>
    /// <returns>The dimensions.</returns>
    public static Index4D GetDimensions <T>(this T[,,,] array)
    {
        Contracts.Requires.That(array != null);

        return(new Index4D(
                   array.GetLength((int)Axis4D.X),
                   array.GetLength((int)Axis4D.Y),
                   array.GetLength((int)Axis4D.Z),
                   array.GetLength((int)Axis4D.W)));
    }
예제 #28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MultidirectionalDynamicArray4D{TValue}"/> class.
        /// </summary>
        /// <param name="dimensions">The dimensions of the array.</param>
        public MultidirectionalDynamicArray4D(Index4D dimensions)
        {
            Contracts.Requires.That(dimensions.IsAllPositive());

            this.array   = new T[dimensions.X, dimensions.Y, dimensions.Z, dimensions.W];
            this.xOrigin = dimensions.X / 2;
            this.yOrigin = dimensions.Y / 2;
            this.zOrigin = dimensions.Z / 2;
            this.wOrigin = dimensions.W / 2;
        }
예제 #29
0
    /// <summary>
    /// Gets the inclusive lower bounds of an array.
    /// </summary>
    /// <typeparam name="T">The type of values stored in the array.</typeparam>
    /// <param name="array">The array.</param>
    /// <returns>The inclusive upper bounds.</returns>
    public static Index4D GetLowerBounds <T>(this T[,,,] array)
    {
        Contracts.Requires.That(array != null);

        return(new Index4D(
                   array.GetLowerBound((int)Axis4D.X),
                   array.GetLowerBound((int)Axis4D.Y),
                   array.GetLowerBound((int)Axis4D.Z),
                   array.GetLowerBound((int)Axis4D.W)));
    }
        public void Serialize(ref JsonWriter writer, T[,,,] value, IJsonFormatterResolver formatterResolver)
        {
            if (value == null)
            {
                writer.WriteNull();
            }
            else
            {
                var formatter = formatterResolver.GetFormatterWithVerify <T>();

                var iLength = value.GetLength(0);
                var jLength = value.GetLength(1);
                var kLength = value.GetLength(2);
                var lLength = value.GetLength(3);

                writer.WriteBeginArray();
                for (var i = 0; i < iLength; i++)
                {
                    if (i != 0)
                    {
                        writer.WriteValueSeparator();
                    }
                    writer.WriteBeginArray();
                    for (var j = 0; j < jLength; j++)
                    {
                        if (j != 0)
                        {
                            writer.WriteValueSeparator();
                        }
                        writer.WriteBeginArray();
                        for (var k = 0; k < kLength; k++)
                        {
                            if (k != 0)
                            {
                                writer.WriteValueSeparator();
                            }
                            writer.WriteBeginArray();
                            for (var l = 0; l < lLength; l++)
                            {
                                if (l != 0)
                                {
                                    writer.WriteValueSeparator();
                                }
                                formatter.Serialize(ref writer, value[i, j, k, l], formatterResolver);
                            }
                            writer.WriteEndArray();
                        }
                        writer.WriteEndArray();
                    }
                    writer.WriteEndArray();
                }
                writer.WriteEndArray();
            }
        }