/// /// This file is part of ILNumerics Community Edition. /// /// ILNumerics Community Edition - high performance computing for applications. /// Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net /// /// ILNumerics Community Edition is free software: you can redistribute it and/or modify /// it under the terms of the GNU General Public License version 3 as published by /// the Free Software Foundation. /// /// ILNumerics Community Edition is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with ILNumerics Community Edition. See the file License.txt in the root /// of your distribution package. If not, see . /// /// In addition this software uses the following components and/or licenses: /// /// ================================================================================= /// The Open Toolkit Library License /// /// Copyright (c) 2006 - 2009 the Open Toolkit library. /// /// Permission is hereby granted, free of charge, to any person obtaining a copy /// of this software and associated documentation files (the "Software"), to deal /// in the Software without restriction, including without limitation the rights to /// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of /// the Software, and to permit persons to whom the Software is furnished to do /// so, subject to the following conditions: /// /// The above copyright notice and this permission notice shall be included in all /// copies or substantial portions of the Software. /// /// ================================================================================= /// using System; using System.Collections.Generic; using System.Text; using ILNumerics.Storage; using ILNumerics.Misc; using ILNumerics.Exceptions; using System.Runtime.InteropServices; using System.Numerics; namespace ILNumerics { public partial class ILMath { /// /// Convert a numeric array to another numeric type /// /// Input array /// Type of array to convert /// Type of array to return /// Converted array /// The newly created array will be converted to the required type. /// The array returned will always use new memory! Even if the type requested /// matches the incoming type. public static unsafe ILRetArray convert(ILInArray X) { using (ILScope.Enter(X)) { outT[] retArrGen = ILMemoryPool.Pool.New(X.Size.NumberOfElements); inT[] inArrGen = X.GetArrayForRead(); if (inArrGen is double[]) { #region input double double[] inArr = (double[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (double * pinArr = inArr) { double * pInWalk = pinArr; double * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is float[]) { #region input float float[] inArr = (float[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (float * pinArr = inArr) { float * pInWalk = pinArr; float * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is complex[]) { #region input complex complex[] inArr = (complex[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (complex * pinArr = inArr) { complex * pInWalk = pinArr; complex * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else if (retArrGen is Complex[]) { GCHandle retHandle = GCHandle.Alloc(retArrGen,GCHandleType.Pinned); GCHandle inHandle = GCHandle.Alloc(inArrGen,GCHandleType.Pinned); complex* retP = (complex*)retHandle.AddrOfPinnedObject(); complex* inP = (complex*)inHandle.AddrOfPinnedObject(); complex2ComplexHelper(inP, retP, X.S.NumberOfElements); retHandle.Free(); inHandle.Free(); } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is fcomplex[]) { #region input fcomplex fcomplex[] inArr = (fcomplex[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (fcomplex * pinArr = inArr) { fcomplex * pInWalk = pinArr; fcomplex * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is byte[]) { #region input byte byte[] inArr = (byte[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (byte * pinArr = inArr) { byte * pInWalk = pinArr; byte * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is Int32[]) { #region input Int32 Int32[] inArr = (Int32[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (Int32 * pinArr = inArr) { Int32 * pInWalk = pinArr; Int32 * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is Int64[]) { #region input Int64 Int64[] inArr = (Int64[])(object)inArrGen; if (false) { } else if (retArrGen is double []) { double [] dummyArray = ( double [])(object)retArrGen; fixed ( double * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; double * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( double ) (*(pInWalk++)); } } #region HYCALPER AUTO GENERATED CODE } else if (retArrGen is Int64 []) { Int64 [] dummyArray = ( Int64 [])(object)retArrGen; fixed ( Int64 * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; Int64 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int64 ) (*(pInWalk++)); } } } else if (retArrGen is Int32 []) { Int32 [] dummyArray = ( Int32 [])(object)retArrGen; fixed ( Int32 * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; Int32 * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( Int32 ) (*(pInWalk++)); } } } else if (retArrGen is byte []) { byte [] dummyArray = ( byte [])(object)retArrGen; fixed ( byte * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; byte * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( byte ) (*(pInWalk++)); } } } else if (retArrGen is fcomplex []) { fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen; fixed ( fcomplex * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; fcomplex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( fcomplex ) (*(pInWalk++)); } } } else if (retArrGen is complex []) { complex [] dummyArray = ( complex [])(object)retArrGen; fixed ( complex * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; complex * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( complex ) (*(pInWalk++)); } } } else if (retArrGen is float []) { float [] dummyArray = ( float [])(object)retArrGen; fixed ( float * pretArr = dummyArray) fixed (Int64 * pinArr = inArr) { Int64 * pInWalk = pinArr; Int64 * pInEnd = pinArr + X.S.NumberOfElements; float * pRetWalk = pretArr; while (pInWalk < pInEnd) { *(pRetWalk++) = ( float ) (*(pInWalk++)); } } #endregion HYCALPER AUTO GENERATED CODE } else throw new ILArgumentException("unsupported target type: " + typeof(outT).Name); #endregion } else if (inArrGen is Complex[] && retArrGen is complex[]) { GCHandle retHandle = GCHandle.Alloc(retArrGen, GCHandleType.Pinned); GCHandle inHandle = GCHandle.Alloc(inArrGen, GCHandleType.Pinned); complex* retP = (complex*)retHandle.AddrOfPinnedObject(); complex* inP = (complex*)inHandle.AddrOfPinnedObject(); complex2ComplexHelper(inP, retP, X.S.NumberOfElements); retHandle.Free(); inHandle.Free(); } else throw new ILArgumentException(String.Format("conversion from {0} to {1} is currently not supported.", typeof(inT).Name, typeof(outT).Name)); return new ILRetArray(retArrGen,X.Size); } } unsafe internal static void complex2ComplexHelper(complex* inArr, complex* outArr, int len) { while (len > 8) { outArr[0] = inArr[0]; outArr[1] = inArr[1]; outArr[2] = inArr[2]; outArr[3] = inArr[3]; outArr[4] = inArr[4]; outArr[5] = inArr[5]; outArr[6] = inArr[6]; outArr[7] = inArr[7]; inArr += 8; outArr += 8; len -= 8; } while (len-- > 0) *outArr++ = *inArr++; } /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< double > X) { return convert< double ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< double > X) { return convert< double ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< double > X) { return convert< double ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< double > X) { return convert< double ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< double > X) { return convert< double ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< double > X) { return new ILRetLogical (convert< double ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< double > X) { return convert< double ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< double > X) { return convert< double ,Int64>(X); } #region HYCALPER AUTO GENERATED CODE /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< Int64 > X) { return convert< Int64 ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< Int64 > X) { return convert< Int64 ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< Int64 > X) { return convert< Int64 ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< Int64 > X) { return convert< Int64 ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< Int64 > X) { return convert< Int64 ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< Int64 > X) { return new ILRetLogical (convert< Int64 ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< Int64 > X) { return convert< Int64 ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< Int64 > X) { return convert< Int64 ,Int64>(X); } /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< Int32 > X) { return convert< Int32 ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< Int32 > X) { return convert< Int32 ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< Int32 > X) { return convert< Int32 ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< Int32 > X) { return convert< Int32 ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< Int32 > X) { return convert< Int32 ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< Int32 > X) { return new ILRetLogical (convert< Int32 ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< Int32 > X) { return convert< Int32 ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< Int32 > X) { return convert< Int32 ,Int64>(X); } /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< byte > X) { return convert< byte ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< byte > X) { return convert< byte ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< byte > X) { return convert< byte ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< byte > X) { return convert< byte ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< byte > X) { return convert< byte ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< byte > X) { return new ILRetLogical (convert< byte ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< byte > X) { return convert< byte ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< byte > X) { return convert< byte ,Int64>(X); } /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< fcomplex > X) { return convert< fcomplex ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< fcomplex > X) { return convert< fcomplex ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< fcomplex > X) { return convert< fcomplex ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< fcomplex > X) { return convert< fcomplex ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< fcomplex > X) { return convert< fcomplex ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< fcomplex > X) { return new ILRetLogical (convert< fcomplex ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< fcomplex > X) { return convert< fcomplex ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< fcomplex > X) { return convert< fcomplex ,Int64>(X); } /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< complex > X) { return convert< complex ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< complex > X) { return convert< complex ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< complex > X) { return convert< complex ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< complex > X) { return convert< complex ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< complex > X) { return convert< complex ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< complex > X) { return new ILRetLogical (convert< complex ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< complex > X) { return convert< complex ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< complex > X) { return convert< complex ,Int64>(X); } /// /// Convert numeric array to double array /// /// Input array /// double array /// The function converts elements of X to double using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray todouble(ILInArray< float > X) { return convert< float ,double>(X); } /// /// Convert numeric array to float array /// /// Input array /// float array /// The new array converts elements of X to float using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tosingle(ILInArray< float > X) { return convert< float ,float>(X); } /// /// Convert numeric array to complex array /// /// Input array /// complex array /// Real input arrays will be converted to the real part of the complex array returned. /// The function converts elements of X to complex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tocomplex(ILInArray< float > X) { return convert< float ,complex>(X); } /// /// Convert numeric array to fcomplex array /// /// Input array /// fcomplex array /// /// Real input arrays are converted to the real part of the complex array returned. /// The function converts elements of X to fcomplex using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tofcomplex(ILInArray< float > X) { return convert< float ,fcomplex>(X); } /// /// Convert numeric array to byte array /// /// Input array /// byte array /// The function converts elements of X to byte using standard explicit system conversions. /// The new array uses new memory, even if the incoming type is the same as the output type. public static ILRetArray tobyte(ILInArray< float > X) { return convert< float ,byte>(X); } /// /// Convert numeric array to logical array /// /// Input array /// Logical array /// The function converts elements of X to byte using standard explicit system conversions. Non-zero /// elements are converted to true, zero-elements are converted to false. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetLogical tological(ILInArray< float > X) { return new ILRetLogical (convert< float ,byte>(X).Storage as ILDenseStorage); } /// /// Convert numeric array to Int32 array /// /// Input array /// Int32 array /// The function converts elements of X to Int32 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint32(ILInArray< float > X) { return convert< float ,Int32>(X); } /// /// Convert numeric array to Int64 array /// /// Input array /// Int64 array /// The function converts elements of X to Int64 using standard explicit system conversions. /// The new array will always use new memory, even if the incoming type is the same as the output type. public static ILRetArray toint64(ILInArray< float > X) { return convert< float ,Int64>(X); } #endregion HYCALPER AUTO GENERATED CODE /// /// convert arbitrary numeric array to double array /// /// numeric array, one of supported numeric type /// double array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< double> todouble(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } #region HYCALPER AUTO GENERATED CODE /// convert arbitrary numeric array to Int64 array /// numeric array, one of supported numeric type /// Int64 array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< Int64> toint64(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } /// convert arbitrary numeric array to Int32 array /// numeric array, one of supported numeric type /// Int32 array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< Int32> toint32(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } /// convert arbitrary numeric array to byte array /// numeric array, one of supported numeric type /// byte array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< byte> tobyte(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } /// convert arbitrary numeric array to fcomplex array /// numeric array, one of supported numeric type /// fcomplex array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< fcomplex> tofcomplex(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } /// convert arbitrary numeric array to complex array /// numeric array, one of supported numeric type /// complex array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< complex> tocomplex(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } /// convert arbitrary numeric array to float array /// numeric array, one of supported numeric type /// float array /// This function enables to convert arbitrary numeric (dense) arrays to a known output array type /// - without knowing the concrete numeric type of the source. Supported element types include: double, /// float, complex, fcomplex, byte, logical, Int32, Int64. /// This function will always create new memory for the new array, even if both /// arrays have the same element type. /// /// if elements of X are /// not of any supported numeric type public static ILRetArray< float> tosingle(ILBaseArray X) { using (ILScope.Enter(X)) { if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else if (X is ILDenseArray) return convert((X as ILDenseArray).C); else throw new ILArgumentException("input type not supported: " + X.GetType().Name); } } #endregion HYCALPER AUTO GENERATED CODE } }