コード例 #1
0
ファイル: mxLogicalArray.cs プロジェクト: dacho68/matlabapi
        public override Array ToArray() {
            IntPtr ptr = matrix.mxGetLogicals(this.NativeObject);
            int row = this.M, col = this.N;
            int size = this.ElementSize;

            byte[] buffer = new byte[row * col * size];
            Marshal.Copy(ptr, buffer, 0, buffer.Length);
            return BitConverterExtesions.ToArray(buffer, row, col);
        }
コード例 #2
0
        public override Array ToArray()
        {
            IntPtr ptr = matrix.mxGetData(base.NativeObject);
            int    m = this.M, n = this.N, size = this.ElementSize;

            byte[] buffer = new byte[m * n * size];

            Marshal.Copy(ptr, buffer, 0, buffer.Length);
            return(BitConverterExtesions.ToArray(buffer, m, n, this.NumericType));
        }
コード例 #3
0
ファイル: mxLogicalArray.cs プロジェクト: dacho68/matlabapi
        /// <summary>
        /// Create a logical array of two dimsensions with bool array.
        /// </summary>
        /// <param name="values">The given bool array.</param>
        public mxLogicalArray(bool[,] values) {
            if (values == null || values.Length == 0)
                throw new ArgumentNullException("values", "The values must be not null or empty.");

            SafeArrayPtr pa = matrix.mxCreateLogicalArray(2, new int[] { values.GetLength(0), values.GetLength(1) });
            CreateArray(pa, mxArrayType.Logical);

            byte[] buf = BitConverterExtesions.GetBytes(values);
            IntPtr ptr = matrix.mxGetData(this.NativeObject);
            Marshal.Copy(buf, 0, ptr, buf.Length);
        }
コード例 #4
0
 public mxNumericArray(int[,] realValues, int[,] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), realValues.GetLength(0), realValues.GetLength(1), mxNumericType.INT32)
 {
 }
コード例 #5
0
 public mxNumericArray(double[,] values)
     : this(BitConverterExtesions.GetBytes(values), values.GetLength(0), values.GetLength(1), mxNumericType.DOUBLE)
 {
 }
コード例 #6
0
 public mxNumericArray(float[,] values)
     : this(BitConverterExtesions.GetBytes(values), values.GetLength(0), values.GetLength(1), mxNumericType.SINGLE)
 {
 }
コード例 #7
0
 public mxNumericArray(ulong[,] values)
     : this(BitConverterExtesions.GetBytes(values), values.GetLength(0), values.GetLength(1), mxNumericType.UINT64)
 {
 }
コード例 #8
0
 public mxNumericArray(int[,] values)
     : this(BitConverterExtesions.GetBytes(values), values.GetLength(0), values.GetLength(1), mxNumericType.INT32)
 {
 }
コード例 #9
0
 public mxNumericArray(ulong[] values)
     : this(BitConverterExtesions.GetBytes(values), BitConverterExtesions.ulong_size, mxNumericType.UINT64)
 {
 }
コード例 #10
0
 public mxNumericArray(double[,] realValues, double[,] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), realValues.GetLength(0), realValues.GetLength(1), mxNumericType.DOUBLE)
 {
 }
コード例 #11
0
 public mxNumericArray(ulong[] realValues, ulong[] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), BitConverterExtesions.ulong_size, mxNumericType.UINT64)
 {
 }
コード例 #12
0
 public mxNumericArray(uint[] realValues, uint[] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), BitConverterExtesions.uint_size, mxNumericType.UINT32)
 {
 }
コード例 #13
0
 public mxNumericArray(short[] realValues, short[] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), BitConverterExtesions.short_size, mxNumericType.INT16)
 {
 }
コード例 #14
0
 public mxNumericArray(sbyte[] realValues, sbyte[] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), BitConverterExtesions.byte_size, mxNumericType.INT8)
 {
 }
コード例 #15
0
 public mxNumericArray(double[] values)
     : this(BitConverterExtesions.GetBytes(values), BitConverterExtesions.double_size, mxNumericType.DOUBLE)
 {
 }
コード例 #16
0
 public mxNumericArray(float[] values)
     : this(BitConverterExtesions.GetBytes(values), BitConverterExtesions.float_size, mxNumericType.SINGLE)
 {
 }
コード例 #17
0
 public mxNumericArray(ulong[,] realValues, ulong[,] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), realValues.GetLength(0), realValues.GetLength(1), mxNumericType.UINT64)
 {
 }
コード例 #18
0
 public mxNumericArray(float[,] realValues, float[,] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), realValues.GetLength(0), realValues.GetLength(1), mxNumericType.SINGLE)
 {
 }
コード例 #19
0
 public mxNumericArray(ushort[] values)
     : this(BitConverterExtesions.GetBytes(values), BitConverterExtesions.ushort_size, mxNumericType.UINT16)
 {
 }
コード例 #20
0
 public mxNumericArray(float[] realValues, float[] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), BitConverterExtesions.float_size, mxNumericType.SINGLE)
 {
 }
コード例 #21
0
 public mxNumericArray(uint[] values)
     : this(BitConverterExtesions.GetBytes(values), BitConverterExtesions.uint_size, mxNumericType.UINT32)
 {
 }
コード例 #22
0
 public mxNumericArray(double[] realValues, double[] imgValues)
     : this(BitConverterExtesions.GetBytes(realValues), BitConverterExtesions.GetBytes(imgValues), BitConverterExtesions.double_size, mxNumericType.DOUBLE)
 {
 }
コード例 #23
0
 public mxNumericArray(sbyte[] values)
     : this(BitConverterExtesions.GetBytes(values), BitConverterExtesions.byte_size, mxNumericType.INT8)
 {
 }