Пример #1
0
        public void IntDataTest()
        {
            var matfile = new DotMatFile();
            var matrix  = new MatlabMatrix(new [] { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10 });

            matfile["intData"] = matrix;
            matfile.WriteToDisk("intData.mat");
        }
Пример #2
0
        public void FloatDataTest()
        {
            var matfile = new DotMatFile();
            var matrix  = new MatlabMatrix(new[] { 1.2f, -2.3f, 3.4f, -4.5f, 5.6f, -6.7f, 7.8f, -8.9f, 9.10f, -10.11f });

            matfile["floatData"] = matrix;
            matfile.WriteToDisk("floatData.mat");
        }
Пример #3
0
        public void DoubleDataTest()
        {
            var matfile = new DotMatFile();
            var matrix  = new MatlabMatrix(new[] { 1.2, -2.3, 3.4, -4.5, 5.6, -6.7, 7.8, -8.9, 9.10, -10.11 });

            matfile["doubleData"] = matrix;
            matfile.WriteToDisk("doubleData.mat");
        }
Пример #4
0
        public void UintDataTest()
        {
            var matfile = new DotMatFile();
            var matrix  = new MatlabMatrix(new uint[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });

            matfile["uintData"] = matrix;
            matfile.WriteToDisk("uintData.mat");
        }
Пример #5
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new sbyte[] { 0, -1, 2, -4, 6, -5, 3, -7 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 2, 2 });

            matfile["threedSbytes"] = matrix;
            matfile.WriteToDisk("threedSbytes.mat");
        }
Пример #6
0
        public void SimpleBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097151 };
            var matrix  = new MatlabMatrix(data);

            matfile["simpleIntegers"] = matrix;
            matfile.WriteToDisk("simpleIntegers.mat");
        }
Пример #7
0
        public void SimpleBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new sbyte[] { 0, -1, 2, -4, 8, -16, 32, -64, 127, -128 };
            var matrix  = new MatlabMatrix(data);

            matfile["simpleSbytes"] = matrix;
            matfile.WriteToDisk("simpleSbytes.mat");
        }
Пример #8
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new[] { 1000000, 1000001, 1000002, 1000004, 1000006, 1000005, 1000003, 1000007 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 2, 2 });

            matfile["threedIntegers"] = matrix;
            matfile.WriteToDisk("threedIntegers.mat");
        }
Пример #9
0
        public void SimpleBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new byte[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 };
            var matrix  = new MatlabMatrix(data);

            matfile["simpleBytes"] = matrix;
            matfile.WriteToDisk("simpleBytes.mat");
        }
Пример #10
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new[] { 0.1f, 1.2f, 2.3f, 4.5f, 6.7f, 5.6f, 3.4f, 7.8f };
            var matrix  = new MatlabMatrix(data, new[] { 2, 2, 2 });

            matfile["threedFloats"] = matrix;
            matfile.WriteToDisk("threedFloats.mat");
        }
Пример #11
0
        public void EmptyBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new uint[0];
            var matrix  = new MatlabMatrix(data);

            matfile["emptyUints"] = matrix;
            matfile.WriteToDisk("emptyUints.mat");
        }
Пример #12
0
        public void SimpleBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new[] { 0.1f, 1.2f, 2.3f, 4.5f, 8.9f, 16.17f, 32.33f, 64.65f, 128.129f, 255.256f };
            var matrix  = new MatlabMatrix(data);

            matfile["simpleFloats"] = matrix;
            matfile.WriteToDisk("simpleFloats.mat");
        }
Пример #13
0
        public void TwoDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new[] { 1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f };
            var matrix  = new MatlabMatrix(data, new[] { 2, 4 });

            matfile["twodFloats"] = matrix;
            matfile.WriteToDisk("twodFloats.mat");
        }
Пример #14
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new uint[] { 4000000, 4000001, 4000002, 4000004, 4000006, 4000005, 4000003, 4000007 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 2, 2 });

            matfile["threedUints"] = matrix;
            matfile.WriteToDisk("threedUints.mat");
        }
Пример #15
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new ushort[] { 0, 1, 2, 4, 6, 5, 3, 7 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 2, 2 });

            matfile["threedUshorts"] = matrix;
            matfile.WriteToDisk("threedUshorts.mat");
        }
Пример #16
0
        public void TwoDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new ushort[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 4 });

            matfile["twodUshorts"] = matrix;
            matfile.WriteToDisk("twodUshorts.mat");
        }
Пример #17
0
        public void SimpleBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new ushort[] { 0, 1, 2, 4, 8, 16, 32, 64, 127, 128 };
            var matrix  = new MatlabMatrix(data);

            matfile["simpleUshorts"] = matrix;
            matfile.WriteToDisk("simpleUshorts.mat");
        }
Пример #18
0
        public void TwoDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new sbyte[] { 1, -2, 3, -4, 5, -6, 7, -8 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 4 });

            matfile["twodSbytes"] = matrix;
            matfile.WriteToDisk("twodSbytes.mat");
        }
Пример #19
0
        public void TwoDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new uint[] { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152 };
            var matrix  = new MatlabMatrix(data, new[] { 2, 11 });

            matfile["twodUints"] = matrix;
            matfile.WriteToDisk("twodUints.mat");
        }
Пример #20
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new [] { 0.1, 1.2, 2.3, 4.5, 6.7, 5.6, 3.4, 7.8 };
            var matrix  = new MatlabMatrix(data, new [] { 2, 2, 2 });

            matfile["threedDoubles"] = matrix;
            matfile.WriteToDisk("threedDoubles.mat");
        }
Пример #21
0
        public void SimpleBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new [] { 0.1, 1.2, 2.3, 4.5, 8.9, 16.17, 32.33, 64.65, 128.129, 255.256 };
            var matrix  = new MatlabMatrix(data);

            matfile["simpleDoubles"] = matrix;
            matfile.WriteToDisk("simpleDoubles.mat");
        }
Пример #22
0
        public void TwoDeeBufferTest()
        {
            var matfile = new DotMatFile();
            var data    = new [] { 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8 };
            var matrix  = new MatlabMatrix(data, new [] { 2, 4 });

            matfile["twodDoubles"] = matrix;
            matfile.WriteToDisk("twodDoubles.mat");
        }
Пример #23
0
        public void TwoDeeBufferTest()
        {
            var matfile = new DotMatFile();

            byte[] data   = { 1, 2, 3, 4, 5, 6, 7, 8 };
            var    matrix = new MatlabMatrix(data, new [] { 2, 4 });

            matfile["twodBytes"] = matrix;
            matfile.WriteToDisk("twodBytes.mat");
        }
Пример #24
0
        public void ThreeDeeBufferTest()
        {
            var matfile = new DotMatFile();

            byte[] data   = { 0, 1, 2, 4, 6, 5, 3, 7 };
            var    matrix = new MatlabMatrix(data, new [] { 2, 2, 2 });

            matfile["threedBytes"] = matrix;
            matfile.WriteToDisk("threedBytes.mat");
        }
Пример #25
0
        public void NullBufferTest()
        {
            var matfile = new DotMatFile();

            int[] buffer = null;
            var   matrix = new MatlabMatrix(buffer);

            matfile["nullData"] = matrix;
            matfile.WriteToDisk("nullData.mat");
        }
Пример #26
0
        private static MatrixElement MatrixForObservable(float[][] observableData)
        {
            MatrixElement matrix = null;

            bool  isIntegral;
            float minimum;
            float maximum;

            CharacterizeData(observableData, out isIntegral, out minimum, out maximum);

            int traceCount  = observableData.Length;
            int sampleCount = observableData[0].Length;

            // floating point
            if (isIntegral)
            {
                // signed
                if (minimum < 0.0f)
                {
                    if ((minimum >= SByte.MinValue) && (maximum <= SByte.MaxValue))
                    {
                        matrix = new MatlabMatrix(ObservableAsInt8(observableData), new[] { traceCount, sampleCount });
                    }
                    else if ((minimum >= Int16.MinValue) && (maximum <= Int16.MaxValue))
                    {
                        matrix = new MatlabMatrix(ObservableAsShort(observableData), new[] { traceCount, sampleCount });
                    }
                    else if ((minimum >= Int32.MinValue) && (maximum <= Int32.MaxValue))
                    {
                        matrix = new MatlabMatrix(ObservableAsInt(observableData), new[] { traceCount, sampleCount });
                    }
                }
                else // unsigned
                {
                    if (maximum <= Byte.MaxValue)
                    {
                        matrix = new MatlabMatrix(ObservableAsByte(observableData), new[] { traceCount, sampleCount });
                    }
                    else if (maximum <= UInt16.MaxValue)
                    {
                        matrix = new MatlabMatrix(ObservableAsUshort(observableData), new[] { traceCount, sampleCount });
                    }
                    else if (maximum <= UInt32.MaxValue)
                    {
                        matrix = new MatlabMatrix(ObservableAsUint(observableData), new[] { traceCount, sampleCount });
                    }
                }
            }

            return(matrix ?? new MatlabMatrix(ObservableAsFloat(observableData), new[] { traceCount, sampleCount }));
        }
Пример #27
0
 public void LongBufferTest()
 {
     var data   = new uint[] { 4000000, 4000001, 4000002, 4000004, 4000006, 4000005, 4000003, 4000007, 4000008, 4000009, 4000010, 4000011, 4000012, 4000013, 4000014, 4000015 };
     var matrix = new MatlabMatrix(data, new[] { 3, 3 });
 }
Пример #28
0
 public void ShortBufferTest()
 {
     var data   = new uint[] { 4000000, 4000001, 4000002, 4000004, 4000006, 4000005, 4000003, 4000007 };
     var matrix = new MatlabMatrix(data, new[] { 3, 3 });
 }
Пример #29
0
 public void LongBufferTest()
 {
     var data   = new[] { 1.2, 2.3, 3.4, 4.5, 5.6, 6.7, 7.8, 8.9, 9.10, 10.11, 11.12, 12.13, 13.14, 14.15, 15.16 };
     var matrix = new MatlabMatrix(data, new [] { 3, 3 });
 }
Пример #30
0
 public void NullBufferTest()
 {
     uint[] data   = null;
     var    matrix = new MatlabMatrix(data);
 }