[9102] | 1 | ///
|
---|
| 2 | /// This file is part of ILNumerics Community Edition.
|
---|
| 3 | ///
|
---|
| 4 | /// ILNumerics Community Edition - high performance computing for applications.
|
---|
| 5 | /// Copyright (C) 2006 - 2012 Haymo Kutschbach, http://ilnumerics.net
|
---|
| 6 | ///
|
---|
| 7 | /// ILNumerics Community Edition is free software: you can redistribute it and/or modify
|
---|
| 8 | /// it under the terms of the GNU General Public License version 3 as published by
|
---|
| 9 | /// the Free Software Foundation.
|
---|
| 10 | ///
|
---|
| 11 | /// ILNumerics Community Edition is distributed in the hope that it will be useful,
|
---|
| 12 | /// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | /// GNU General Public License for more details.
|
---|
| 15 | ///
|
---|
| 16 | /// You should have received a copy of the GNU General Public License
|
---|
| 17 | /// along with ILNumerics Community Edition. See the file License.txt in the root
|
---|
| 18 | /// of your distribution package. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | ///
|
---|
| 20 | /// In addition this software uses the following components and/or licenses:
|
---|
| 21 | ///
|
---|
| 22 | /// =================================================================================
|
---|
| 23 | /// The Open Toolkit Library License
|
---|
| 24 | ///
|
---|
| 25 | /// Copyright (c) 2006 - 2009 the Open Toolkit library.
|
---|
| 26 | ///
|
---|
| 27 | /// Permission is hereby granted, free of charge, to any person obtaining a copy
|
---|
| 28 | /// of this software and associated documentation files (the "Software"), to deal
|
---|
| 29 | /// in the Software without restriction, including without limitation the rights to
|
---|
| 30 | /// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
---|
| 31 | /// the Software, and to permit persons to whom the Software is furnished to do
|
---|
| 32 | /// so, subject to the following conditions:
|
---|
| 33 | ///
|
---|
| 34 | /// The above copyright notice and this permission notice shall be included in all
|
---|
| 35 | /// copies or substantial portions of the Software.
|
---|
| 36 | ///
|
---|
| 37 | /// =================================================================================
|
---|
| 38 | ///
|
---|
| 39 |
|
---|
| 40 | using System;
|
---|
| 41 | using System.Collections.Generic;
|
---|
| 42 | using System.Text;
|
---|
| 43 | using ILNumerics.Storage;
|
---|
| 44 | using ILNumerics.Misc;
|
---|
| 45 | using ILNumerics.Exceptions;
|
---|
| 46 | using System.Runtime.InteropServices;
|
---|
| 47 | using System.Numerics;
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | namespace ILNumerics {
|
---|
| 51 | public partial class ILMath {
|
---|
| 52 | /// <summary>
|
---|
| 53 | /// Convert a numeric array to another numeric type
|
---|
| 54 | /// </summary>
|
---|
| 55 | /// <param name="X">Input array</param>
|
---|
| 56 | /// <typeparam name="inT">Type of array to convert</typeparam>
|
---|
| 57 | /// <typeparam name="outT">Type of array to return</typeparam>
|
---|
| 58 | /// <returns>Converted array</returns>
|
---|
| 59 | /// <remarks> The newly created array will be converted to the required type.
|
---|
| 60 | /// <para>The array returned will always use new memory! Even if the type requested
|
---|
| 61 | /// matches the incoming type.</para></remarks>
|
---|
| 62 | public static unsafe ILRetArray<outT> convert<inT, outT>(ILInArray<inT> X) {
|
---|
| 63 | using (ILScope.Enter(X)) {
|
---|
| 64 | outT[] retArrGen = ILMemoryPool.Pool.New<outT>(X.Size.NumberOfElements);
|
---|
| 65 | inT[] inArrGen = X.GetArrayForRead();
|
---|
| 66 | if (inArrGen is double[]) {
|
---|
| 67 | #region input double
|
---|
| 68 | double[] inArr = (double[])(object)inArrGen;
|
---|
| 69 | if (false) {
|
---|
| 70 | |
---|
| 71 | } else if (retArrGen is double []) {
|
---|
| 72 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 73 | fixed ( double * pretArr = dummyArray)
|
---|
| 74 | fixed (double * pinArr = inArr) {
|
---|
| 75 | double * pInWalk = pinArr;
|
---|
| 76 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 77 | double * pRetWalk = pretArr;
|
---|
| 78 | while (pInWalk < pInEnd) {
|
---|
| 79 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 80 | }
|
---|
| 81 | }
|
---|
| 82 | |
---|
| 83 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 84 | |
---|
| 85 | } else if (retArrGen is Int64 []) {
|
---|
| 86 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 87 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 88 | fixed (double * pinArr = inArr) {
|
---|
| 89 | double * pInWalk = pinArr;
|
---|
| 90 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 91 | Int64 * pRetWalk = pretArr;
|
---|
| 92 | while (pInWalk < pInEnd) {
|
---|
| 93 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 94 | }
|
---|
| 95 | }
|
---|
| 96 | } else if (retArrGen is Int32 []) {
|
---|
| 97 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 98 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 99 | fixed (double * pinArr = inArr) {
|
---|
| 100 | double * pInWalk = pinArr;
|
---|
| 101 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 102 | Int32 * pRetWalk = pretArr;
|
---|
| 103 | while (pInWalk < pInEnd) {
|
---|
| 104 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 105 | }
|
---|
| 106 | }
|
---|
| 107 | } else if (retArrGen is byte []) {
|
---|
| 108 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 109 | fixed ( byte * pretArr = dummyArray)
|
---|
| 110 | fixed (double * pinArr = inArr) {
|
---|
| 111 | double * pInWalk = pinArr;
|
---|
| 112 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 113 | byte * pRetWalk = pretArr;
|
---|
| 114 | while (pInWalk < pInEnd) {
|
---|
| 115 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 | } else if (retArrGen is fcomplex []) {
|
---|
| 119 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 120 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 121 | fixed (double * pinArr = inArr) {
|
---|
| 122 | double * pInWalk = pinArr;
|
---|
| 123 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 124 | fcomplex * pRetWalk = pretArr;
|
---|
| 125 | while (pInWalk < pInEnd) {
|
---|
| 126 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 127 | }
|
---|
| 128 | }
|
---|
| 129 | } else if (retArrGen is complex []) {
|
---|
| 130 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 131 | fixed ( complex * pretArr = dummyArray)
|
---|
| 132 | fixed (double * pinArr = inArr) {
|
---|
| 133 | double * pInWalk = pinArr;
|
---|
| 134 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 135 | complex * pRetWalk = pretArr;
|
---|
| 136 | while (pInWalk < pInEnd) {
|
---|
| 137 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 | } else if (retArrGen is float []) {
|
---|
| 141 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 142 | fixed ( float * pretArr = dummyArray)
|
---|
| 143 | fixed (double * pinArr = inArr) {
|
---|
| 144 | double * pInWalk = pinArr;
|
---|
| 145 | double * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 146 | float * pRetWalk = pretArr;
|
---|
| 147 | while (pInWalk < pInEnd) {
|
---|
| 148 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 149 | }
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 153 | } else
|
---|
| 154 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 155 | #endregion
|
---|
| 156 | } else if (inArrGen is float[]) {
|
---|
| 157 | #region input float
|
---|
| 158 | float[] inArr = (float[])(object)inArrGen;
|
---|
| 159 | if (false) {
|
---|
| 160 | |
---|
| 161 | } else if (retArrGen is double []) {
|
---|
| 162 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 163 | fixed ( double * pretArr = dummyArray)
|
---|
| 164 | fixed (float * pinArr = inArr) {
|
---|
| 165 | float * pInWalk = pinArr;
|
---|
| 166 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 167 | double * pRetWalk = pretArr;
|
---|
| 168 | while (pInWalk < pInEnd) {
|
---|
| 169 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 170 | }
|
---|
| 171 | }
|
---|
| 172 | |
---|
| 173 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 174 | |
---|
| 175 | } else if (retArrGen is Int64 []) {
|
---|
| 176 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 177 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 178 | fixed (float * pinArr = inArr) {
|
---|
| 179 | float * pInWalk = pinArr;
|
---|
| 180 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 181 | Int64 * pRetWalk = pretArr;
|
---|
| 182 | while (pInWalk < pInEnd) {
|
---|
| 183 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 184 | }
|
---|
| 185 | }
|
---|
| 186 | } else if (retArrGen is Int32 []) {
|
---|
| 187 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 188 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 189 | fixed (float * pinArr = inArr) {
|
---|
| 190 | float * pInWalk = pinArr;
|
---|
| 191 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 192 | Int32 * pRetWalk = pretArr;
|
---|
| 193 | while (pInWalk < pInEnd) {
|
---|
| 194 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 195 | }
|
---|
| 196 | }
|
---|
| 197 | } else if (retArrGen is byte []) {
|
---|
| 198 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 199 | fixed ( byte * pretArr = dummyArray)
|
---|
| 200 | fixed (float * pinArr = inArr) {
|
---|
| 201 | float * pInWalk = pinArr;
|
---|
| 202 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 203 | byte * pRetWalk = pretArr;
|
---|
| 204 | while (pInWalk < pInEnd) {
|
---|
| 205 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 206 | }
|
---|
| 207 | }
|
---|
| 208 | } else if (retArrGen is fcomplex []) {
|
---|
| 209 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 210 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 211 | fixed (float * pinArr = inArr) {
|
---|
| 212 | float * pInWalk = pinArr;
|
---|
| 213 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 214 | fcomplex * pRetWalk = pretArr;
|
---|
| 215 | while (pInWalk < pInEnd) {
|
---|
| 216 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 217 | }
|
---|
| 218 | }
|
---|
| 219 | } else if (retArrGen is complex []) {
|
---|
| 220 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 221 | fixed ( complex * pretArr = dummyArray)
|
---|
| 222 | fixed (float * pinArr = inArr) {
|
---|
| 223 | float * pInWalk = pinArr;
|
---|
| 224 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 225 | complex * pRetWalk = pretArr;
|
---|
| 226 | while (pInWalk < pInEnd) {
|
---|
| 227 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 228 | }
|
---|
| 229 | }
|
---|
| 230 | } else if (retArrGen is float []) {
|
---|
| 231 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 232 | fixed ( float * pretArr = dummyArray)
|
---|
| 233 | fixed (float * pinArr = inArr) {
|
---|
| 234 | float * pInWalk = pinArr;
|
---|
| 235 | float * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 236 | float * pRetWalk = pretArr;
|
---|
| 237 | while (pInWalk < pInEnd) {
|
---|
| 238 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 239 | }
|
---|
| 240 | }
|
---|
| 241 |
|
---|
| 242 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 243 | } else
|
---|
| 244 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 245 | #endregion
|
---|
| 246 | } else if (inArrGen is complex[]) {
|
---|
| 247 | #region input complex
|
---|
| 248 | complex[] inArr = (complex[])(object)inArrGen;
|
---|
| 249 | if (false) {
|
---|
| 250 | |
---|
| 251 | } else if (retArrGen is double []) {
|
---|
| 252 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 253 | fixed ( double * pretArr = dummyArray)
|
---|
| 254 | fixed (complex * pinArr = inArr) {
|
---|
| 255 | complex * pInWalk = pinArr;
|
---|
| 256 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 257 | double * pRetWalk = pretArr;
|
---|
| 258 | while (pInWalk < pInEnd) {
|
---|
| 259 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 260 | }
|
---|
| 261 | }
|
---|
| 262 | |
---|
| 263 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 264 | |
---|
| 265 | } else if (retArrGen is Int64 []) {
|
---|
| 266 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 267 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 268 | fixed (complex * pinArr = inArr) {
|
---|
| 269 | complex * pInWalk = pinArr;
|
---|
| 270 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 271 | Int64 * pRetWalk = pretArr;
|
---|
| 272 | while (pInWalk < pInEnd) {
|
---|
| 273 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 274 | }
|
---|
| 275 | }
|
---|
| 276 | } else if (retArrGen is Int32 []) {
|
---|
| 277 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 278 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 279 | fixed (complex * pinArr = inArr) {
|
---|
| 280 | complex * pInWalk = pinArr;
|
---|
| 281 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 282 | Int32 * pRetWalk = pretArr;
|
---|
| 283 | while (pInWalk < pInEnd) {
|
---|
| 284 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 285 | }
|
---|
| 286 | }
|
---|
| 287 | } else if (retArrGen is byte []) {
|
---|
| 288 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 289 | fixed ( byte * pretArr = dummyArray)
|
---|
| 290 | fixed (complex * pinArr = inArr) {
|
---|
| 291 | complex * pInWalk = pinArr;
|
---|
| 292 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 293 | byte * pRetWalk = pretArr;
|
---|
| 294 | while (pInWalk < pInEnd) {
|
---|
| 295 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 296 | }
|
---|
| 297 | }
|
---|
| 298 | } else if (retArrGen is fcomplex []) {
|
---|
| 299 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 300 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 301 | fixed (complex * pinArr = inArr) {
|
---|
| 302 | complex * pInWalk = pinArr;
|
---|
| 303 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 304 | fcomplex * pRetWalk = pretArr;
|
---|
| 305 | while (pInWalk < pInEnd) {
|
---|
| 306 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 307 | }
|
---|
| 308 | }
|
---|
| 309 | } else if (retArrGen is complex []) {
|
---|
| 310 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 311 | fixed ( complex * pretArr = dummyArray)
|
---|
| 312 | fixed (complex * pinArr = inArr) {
|
---|
| 313 | complex * pInWalk = pinArr;
|
---|
| 314 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 315 | complex * pRetWalk = pretArr;
|
---|
| 316 | while (pInWalk < pInEnd) {
|
---|
| 317 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 318 | }
|
---|
| 319 | }
|
---|
| 320 | } else if (retArrGen is float []) {
|
---|
| 321 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 322 | fixed ( float * pretArr = dummyArray)
|
---|
| 323 | fixed (complex * pinArr = inArr) {
|
---|
| 324 | complex * pInWalk = pinArr;
|
---|
| 325 | complex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 326 | float * pRetWalk = pretArr;
|
---|
| 327 | while (pInWalk < pInEnd) {
|
---|
| 328 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 329 | }
|
---|
| 330 | }
|
---|
| 331 |
|
---|
| 332 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 333 | } else if (retArrGen is Complex[]) {
|
---|
| 334 | GCHandle retHandle = GCHandle.Alloc(retArrGen,GCHandleType.Pinned);
|
---|
| 335 | GCHandle inHandle = GCHandle.Alloc(inArrGen,GCHandleType.Pinned);
|
---|
| 336 | complex* retP = (complex*)retHandle.AddrOfPinnedObject();
|
---|
| 337 | complex* inP = (complex*)inHandle.AddrOfPinnedObject();
|
---|
| 338 | complex2ComplexHelper(inP, retP, X.S.NumberOfElements);
|
---|
| 339 | retHandle.Free();
|
---|
| 340 | inHandle.Free();
|
---|
| 341 | } else
|
---|
| 342 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 343 | #endregion
|
---|
| 344 | } else if (inArrGen is fcomplex[]) {
|
---|
| 345 | #region input fcomplex
|
---|
| 346 | fcomplex[] inArr = (fcomplex[])(object)inArrGen;
|
---|
| 347 | if (false) {
|
---|
| 348 | |
---|
| 349 | } else if (retArrGen is double []) {
|
---|
| 350 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 351 | fixed ( double * pretArr = dummyArray)
|
---|
| 352 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 353 | fcomplex * pInWalk = pinArr;
|
---|
| 354 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 355 | double * pRetWalk = pretArr;
|
---|
| 356 | while (pInWalk < pInEnd) {
|
---|
| 357 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 358 | }
|
---|
| 359 | }
|
---|
| 360 | |
---|
| 361 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 362 | |
---|
| 363 | } else if (retArrGen is Int64 []) {
|
---|
| 364 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 365 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 366 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 367 | fcomplex * pInWalk = pinArr;
|
---|
| 368 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 369 | Int64 * pRetWalk = pretArr;
|
---|
| 370 | while (pInWalk < pInEnd) {
|
---|
| 371 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 372 | }
|
---|
| 373 | }
|
---|
| 374 | } else if (retArrGen is Int32 []) {
|
---|
| 375 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 376 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 377 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 378 | fcomplex * pInWalk = pinArr;
|
---|
| 379 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 380 | Int32 * pRetWalk = pretArr;
|
---|
| 381 | while (pInWalk < pInEnd) {
|
---|
| 382 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 383 | }
|
---|
| 384 | }
|
---|
| 385 | } else if (retArrGen is byte []) {
|
---|
| 386 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 387 | fixed ( byte * pretArr = dummyArray)
|
---|
| 388 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 389 | fcomplex * pInWalk = pinArr;
|
---|
| 390 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 391 | byte * pRetWalk = pretArr;
|
---|
| 392 | while (pInWalk < pInEnd) {
|
---|
| 393 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 394 | }
|
---|
| 395 | }
|
---|
| 396 | } else if (retArrGen is fcomplex []) {
|
---|
| 397 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 398 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 399 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 400 | fcomplex * pInWalk = pinArr;
|
---|
| 401 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 402 | fcomplex * pRetWalk = pretArr;
|
---|
| 403 | while (pInWalk < pInEnd) {
|
---|
| 404 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 405 | }
|
---|
| 406 | }
|
---|
| 407 | } else if (retArrGen is complex []) {
|
---|
| 408 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 409 | fixed ( complex * pretArr = dummyArray)
|
---|
| 410 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 411 | fcomplex * pInWalk = pinArr;
|
---|
| 412 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 413 | complex * pRetWalk = pretArr;
|
---|
| 414 | while (pInWalk < pInEnd) {
|
---|
| 415 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 416 | }
|
---|
| 417 | }
|
---|
| 418 | } else if (retArrGen is float []) {
|
---|
| 419 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 420 | fixed ( float * pretArr = dummyArray)
|
---|
| 421 | fixed (fcomplex * pinArr = inArr) {
|
---|
| 422 | fcomplex * pInWalk = pinArr;
|
---|
| 423 | fcomplex * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 424 | float * pRetWalk = pretArr;
|
---|
| 425 | while (pInWalk < pInEnd) {
|
---|
| 426 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 427 | }
|
---|
| 428 | }
|
---|
| 429 |
|
---|
| 430 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 431 | } else
|
---|
| 432 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 433 | #endregion
|
---|
| 434 | } else if (inArrGen is byte[]) {
|
---|
| 435 | #region input byte
|
---|
| 436 | byte[] inArr = (byte[])(object)inArrGen;
|
---|
| 437 | if (false) {
|
---|
| 438 | |
---|
| 439 | } else if (retArrGen is double []) {
|
---|
| 440 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 441 | fixed ( double * pretArr = dummyArray)
|
---|
| 442 | fixed (byte * pinArr = inArr) {
|
---|
| 443 | byte * pInWalk = pinArr;
|
---|
| 444 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 445 | double * pRetWalk = pretArr;
|
---|
| 446 | while (pInWalk < pInEnd) {
|
---|
| 447 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 448 | }
|
---|
| 449 | }
|
---|
| 450 | |
---|
| 451 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 452 | |
---|
| 453 | } else if (retArrGen is Int64 []) {
|
---|
| 454 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 455 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 456 | fixed (byte * pinArr = inArr) {
|
---|
| 457 | byte * pInWalk = pinArr;
|
---|
| 458 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 459 | Int64 * pRetWalk = pretArr;
|
---|
| 460 | while (pInWalk < pInEnd) {
|
---|
| 461 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 462 | }
|
---|
| 463 | }
|
---|
| 464 | } else if (retArrGen is Int32 []) {
|
---|
| 465 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 466 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 467 | fixed (byte * pinArr = inArr) {
|
---|
| 468 | byte * pInWalk = pinArr;
|
---|
| 469 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 470 | Int32 * pRetWalk = pretArr;
|
---|
| 471 | while (pInWalk < pInEnd) {
|
---|
| 472 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 473 | }
|
---|
| 474 | }
|
---|
| 475 | } else if (retArrGen is byte []) {
|
---|
| 476 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 477 | fixed ( byte * pretArr = dummyArray)
|
---|
| 478 | fixed (byte * pinArr = inArr) {
|
---|
| 479 | byte * pInWalk = pinArr;
|
---|
| 480 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 481 | byte * pRetWalk = pretArr;
|
---|
| 482 | while (pInWalk < pInEnd) {
|
---|
| 483 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 484 | }
|
---|
| 485 | }
|
---|
| 486 | } else if (retArrGen is fcomplex []) {
|
---|
| 487 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 488 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 489 | fixed (byte * pinArr = inArr) {
|
---|
| 490 | byte * pInWalk = pinArr;
|
---|
| 491 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 492 | fcomplex * pRetWalk = pretArr;
|
---|
| 493 | while (pInWalk < pInEnd) {
|
---|
| 494 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 495 | }
|
---|
| 496 | }
|
---|
| 497 | } else if (retArrGen is complex []) {
|
---|
| 498 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 499 | fixed ( complex * pretArr = dummyArray)
|
---|
| 500 | fixed (byte * pinArr = inArr) {
|
---|
| 501 | byte * pInWalk = pinArr;
|
---|
| 502 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 503 | complex * pRetWalk = pretArr;
|
---|
| 504 | while (pInWalk < pInEnd) {
|
---|
| 505 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 506 | }
|
---|
| 507 | }
|
---|
| 508 | } else if (retArrGen is float []) {
|
---|
| 509 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 510 | fixed ( float * pretArr = dummyArray)
|
---|
| 511 | fixed (byte * pinArr = inArr) {
|
---|
| 512 | byte * pInWalk = pinArr;
|
---|
| 513 | byte * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 514 | float * pRetWalk = pretArr;
|
---|
| 515 | while (pInWalk < pInEnd) {
|
---|
| 516 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 517 | }
|
---|
| 518 | }
|
---|
| 519 |
|
---|
| 520 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 521 | } else
|
---|
| 522 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 523 | #endregion
|
---|
| 524 | } else if (inArrGen is Int32[]) {
|
---|
| 525 | #region input Int32
|
---|
| 526 | Int32[] inArr = (Int32[])(object)inArrGen;
|
---|
| 527 | if (false) {
|
---|
| 528 | |
---|
| 529 | } else if (retArrGen is double []) {
|
---|
| 530 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 531 | fixed ( double * pretArr = dummyArray)
|
---|
| 532 | fixed (Int32 * pinArr = inArr) {
|
---|
| 533 | Int32 * pInWalk = pinArr;
|
---|
| 534 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 535 | double * pRetWalk = pretArr;
|
---|
| 536 | while (pInWalk < pInEnd) {
|
---|
| 537 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 538 | }
|
---|
| 539 | }
|
---|
| 540 | |
---|
| 541 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 542 | |
---|
| 543 | } else if (retArrGen is Int64 []) {
|
---|
| 544 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 545 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 546 | fixed (Int32 * pinArr = inArr) {
|
---|
| 547 | Int32 * pInWalk = pinArr;
|
---|
| 548 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 549 | Int64 * pRetWalk = pretArr;
|
---|
| 550 | while (pInWalk < pInEnd) {
|
---|
| 551 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 552 | }
|
---|
| 553 | }
|
---|
| 554 | } else if (retArrGen is Int32 []) {
|
---|
| 555 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 556 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 557 | fixed (Int32 * pinArr = inArr) {
|
---|
| 558 | Int32 * pInWalk = pinArr;
|
---|
| 559 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 560 | Int32 * pRetWalk = pretArr;
|
---|
| 561 | while (pInWalk < pInEnd) {
|
---|
| 562 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 563 | }
|
---|
| 564 | }
|
---|
| 565 | } else if (retArrGen is byte []) {
|
---|
| 566 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 567 | fixed ( byte * pretArr = dummyArray)
|
---|
| 568 | fixed (Int32 * pinArr = inArr) {
|
---|
| 569 | Int32 * pInWalk = pinArr;
|
---|
| 570 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 571 | byte * pRetWalk = pretArr;
|
---|
| 572 | while (pInWalk < pInEnd) {
|
---|
| 573 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 574 | }
|
---|
| 575 | }
|
---|
| 576 | } else if (retArrGen is fcomplex []) {
|
---|
| 577 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 578 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 579 | fixed (Int32 * pinArr = inArr) {
|
---|
| 580 | Int32 * pInWalk = pinArr;
|
---|
| 581 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 582 | fcomplex * pRetWalk = pretArr;
|
---|
| 583 | while (pInWalk < pInEnd) {
|
---|
| 584 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 585 | }
|
---|
| 586 | }
|
---|
| 587 | } else if (retArrGen is complex []) {
|
---|
| 588 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 589 | fixed ( complex * pretArr = dummyArray)
|
---|
| 590 | fixed (Int32 * pinArr = inArr) {
|
---|
| 591 | Int32 * pInWalk = pinArr;
|
---|
| 592 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 593 | complex * pRetWalk = pretArr;
|
---|
| 594 | while (pInWalk < pInEnd) {
|
---|
| 595 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 596 | }
|
---|
| 597 | }
|
---|
| 598 | } else if (retArrGen is float []) {
|
---|
| 599 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 600 | fixed ( float * pretArr = dummyArray)
|
---|
| 601 | fixed (Int32 * pinArr = inArr) {
|
---|
| 602 | Int32 * pInWalk = pinArr;
|
---|
| 603 | Int32 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 604 | float * pRetWalk = pretArr;
|
---|
| 605 | while (pInWalk < pInEnd) {
|
---|
| 606 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 607 | }
|
---|
| 608 | }
|
---|
| 609 |
|
---|
| 610 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 611 | } else
|
---|
| 612 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 613 | #endregion
|
---|
| 614 | } else if (inArrGen is Int64[]) {
|
---|
| 615 | #region input Int64
|
---|
| 616 | Int64[] inArr = (Int64[])(object)inArrGen;
|
---|
| 617 | if (false) {
|
---|
| 618 | |
---|
| 619 | } else if (retArrGen is double []) {
|
---|
| 620 | double [] dummyArray = ( double [])(object)retArrGen;
|
---|
| 621 | fixed ( double * pretArr = dummyArray)
|
---|
| 622 | fixed (Int64 * pinArr = inArr) {
|
---|
| 623 | Int64 * pInWalk = pinArr;
|
---|
| 624 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 625 | double * pRetWalk = pretArr;
|
---|
| 626 | while (pInWalk < pInEnd) {
|
---|
| 627 | *(pRetWalk++) = ( double ) (*(pInWalk++));
|
---|
| 628 | }
|
---|
| 629 | }
|
---|
| 630 | |
---|
| 631 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 632 | |
---|
| 633 | } else if (retArrGen is Int64 []) {
|
---|
| 634 | Int64 [] dummyArray = ( Int64 [])(object)retArrGen;
|
---|
| 635 | fixed ( Int64 * pretArr = dummyArray)
|
---|
| 636 | fixed (Int64 * pinArr = inArr) {
|
---|
| 637 | Int64 * pInWalk = pinArr;
|
---|
| 638 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 639 | Int64 * pRetWalk = pretArr;
|
---|
| 640 | while (pInWalk < pInEnd) {
|
---|
| 641 | *(pRetWalk++) = ( Int64 ) (*(pInWalk++));
|
---|
| 642 | }
|
---|
| 643 | }
|
---|
| 644 | } else if (retArrGen is Int32 []) {
|
---|
| 645 | Int32 [] dummyArray = ( Int32 [])(object)retArrGen;
|
---|
| 646 | fixed ( Int32 * pretArr = dummyArray)
|
---|
| 647 | fixed (Int64 * pinArr = inArr) {
|
---|
| 648 | Int64 * pInWalk = pinArr;
|
---|
| 649 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 650 | Int32 * pRetWalk = pretArr;
|
---|
| 651 | while (pInWalk < pInEnd) {
|
---|
| 652 | *(pRetWalk++) = ( Int32 ) (*(pInWalk++));
|
---|
| 653 | }
|
---|
| 654 | }
|
---|
| 655 | } else if (retArrGen is byte []) {
|
---|
| 656 | byte [] dummyArray = ( byte [])(object)retArrGen;
|
---|
| 657 | fixed ( byte * pretArr = dummyArray)
|
---|
| 658 | fixed (Int64 * pinArr = inArr) {
|
---|
| 659 | Int64 * pInWalk = pinArr;
|
---|
| 660 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 661 | byte * pRetWalk = pretArr;
|
---|
| 662 | while (pInWalk < pInEnd) {
|
---|
| 663 | *(pRetWalk++) = ( byte ) (*(pInWalk++));
|
---|
| 664 | }
|
---|
| 665 | }
|
---|
| 666 | } else if (retArrGen is fcomplex []) {
|
---|
| 667 | fcomplex [] dummyArray = ( fcomplex [])(object)retArrGen;
|
---|
| 668 | fixed ( fcomplex * pretArr = dummyArray)
|
---|
| 669 | fixed (Int64 * pinArr = inArr) {
|
---|
| 670 | Int64 * pInWalk = pinArr;
|
---|
| 671 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 672 | fcomplex * pRetWalk = pretArr;
|
---|
| 673 | while (pInWalk < pInEnd) {
|
---|
| 674 | *(pRetWalk++) = ( fcomplex ) (*(pInWalk++));
|
---|
| 675 | }
|
---|
| 676 | }
|
---|
| 677 | } else if (retArrGen is complex []) {
|
---|
| 678 | complex [] dummyArray = ( complex [])(object)retArrGen;
|
---|
| 679 | fixed ( complex * pretArr = dummyArray)
|
---|
| 680 | fixed (Int64 * pinArr = inArr) {
|
---|
| 681 | Int64 * pInWalk = pinArr;
|
---|
| 682 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 683 | complex * pRetWalk = pretArr;
|
---|
| 684 | while (pInWalk < pInEnd) {
|
---|
| 685 | *(pRetWalk++) = ( complex ) (*(pInWalk++));
|
---|
| 686 | }
|
---|
| 687 | }
|
---|
| 688 | } else if (retArrGen is float []) {
|
---|
| 689 | float [] dummyArray = ( float [])(object)retArrGen;
|
---|
| 690 | fixed ( float * pretArr = dummyArray)
|
---|
| 691 | fixed (Int64 * pinArr = inArr) {
|
---|
| 692 | Int64 * pInWalk = pinArr;
|
---|
| 693 | Int64 * pInEnd = pinArr + X.S.NumberOfElements;
|
---|
| 694 | float * pRetWalk = pretArr;
|
---|
| 695 | while (pInWalk < pInEnd) {
|
---|
| 696 | *(pRetWalk++) = ( float ) (*(pInWalk++));
|
---|
| 697 | }
|
---|
| 698 | }
|
---|
| 699 |
|
---|
| 700 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 701 | } else
|
---|
| 702 | throw new ILArgumentException("unsupported target type: " + typeof(outT).Name);
|
---|
| 703 | #endregion
|
---|
| 704 | } else if (inArrGen is Complex[] && retArrGen is complex[]) {
|
---|
| 705 | GCHandle retHandle = GCHandle.Alloc(retArrGen, GCHandleType.Pinned);
|
---|
| 706 | GCHandle inHandle = GCHandle.Alloc(inArrGen, GCHandleType.Pinned);
|
---|
| 707 | complex* retP = (complex*)retHandle.AddrOfPinnedObject();
|
---|
| 708 | complex* inP = (complex*)inHandle.AddrOfPinnedObject();
|
---|
| 709 | complex2ComplexHelper(inP, retP, X.S.NumberOfElements);
|
---|
| 710 | retHandle.Free();
|
---|
| 711 | inHandle.Free();
|
---|
| 712 | } else
|
---|
| 713 | throw new ILArgumentException(String.Format("conversion from {0} to {1} is currently not supported.", typeof(inT).Name, typeof(outT).Name));
|
---|
| 714 | return new ILRetArray<outT>(retArrGen,X.Size);
|
---|
| 715 | }
|
---|
| 716 | }
|
---|
| 717 |
|
---|
| 718 | unsafe internal static void complex2ComplexHelper(complex* inArr, complex* outArr, int len) {
|
---|
| 719 | while (len > 8) {
|
---|
| 720 | outArr[0] = inArr[0];
|
---|
| 721 | outArr[1] = inArr[1];
|
---|
| 722 | outArr[2] = inArr[2];
|
---|
| 723 | outArr[3] = inArr[3];
|
---|
| 724 | outArr[4] = inArr[4];
|
---|
| 725 | outArr[5] = inArr[5];
|
---|
| 726 | outArr[6] = inArr[6];
|
---|
| 727 | outArr[7] = inArr[7];
|
---|
| 728 | inArr += 8; outArr += 8; len -= 8;
|
---|
| 729 | }
|
---|
| 730 | while (len-- > 0) *outArr++ = *inArr++;
|
---|
| 731 | }
|
---|
| 732 |
|
---|
| 733 | |
---|
| 734 | /// <summary>
|
---|
| 735 | /// Convert numeric array to double array
|
---|
| 736 | /// </summary>
|
---|
| 737 | /// <param name="X">Input array</param>
|
---|
| 738 | /// <returns>double array</returns>
|
---|
| 739 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 740 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 741 | public static ILRetArray<double> todouble(ILInArray< double > X) {
|
---|
| 742 | return convert< double ,double>(X);
|
---|
| 743 | }
|
---|
| 744 | /// <summary>
|
---|
| 745 | /// Convert numeric array to float array
|
---|
| 746 | /// </summary>
|
---|
| 747 | /// <param name="X">Input array</param>
|
---|
| 748 | /// <returns>float array</returns>
|
---|
| 749 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 750 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 751 | public static ILRetArray<float> tosingle(ILInArray< double > X) {
|
---|
| 752 | return convert< double ,float>(X);
|
---|
| 753 | }
|
---|
| 754 | /// <summary>
|
---|
| 755 | /// Convert numeric array to complex array
|
---|
| 756 | /// </summary>
|
---|
| 757 | /// <param name="X">Input array </param>
|
---|
| 758 | /// <returns>complex array</returns>
|
---|
| 759 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 760 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 761 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 762 | public static ILRetArray<complex> tocomplex(ILInArray< double > X) {
|
---|
| 763 | return convert< double ,complex>(X);
|
---|
| 764 | }
|
---|
| 765 | /// <summary>
|
---|
| 766 | /// Convert numeric array to fcomplex array
|
---|
| 767 | /// </summary>
|
---|
| 768 | /// <param name="X">Input array </param>
|
---|
| 769 | /// <returns>fcomplex array</returns>
|
---|
| 770 | /// <remarks>
|
---|
| 771 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 772 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 773 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 774 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< double > X) {
|
---|
| 775 | return convert< double ,fcomplex>(X);
|
---|
| 776 | }
|
---|
| 777 | /// <summary>
|
---|
| 778 | /// Convert numeric array to byte array
|
---|
| 779 | /// </summary>
|
---|
| 780 | /// <param name="X">Input array </param>
|
---|
| 781 | /// <returns>byte array</returns>
|
---|
| 782 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 783 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 784 | public static ILRetArray<byte> tobyte(ILInArray< double > X) {
|
---|
| 785 | return convert< double ,byte>(X);
|
---|
| 786 | }
|
---|
| 787 | /// <summary>
|
---|
| 788 | /// Convert numeric array to logical array
|
---|
| 789 | /// </summary>
|
---|
| 790 | /// <param name="X">Input array </param>
|
---|
| 791 | /// <returns>Logical array</returns>
|
---|
| 792 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 793 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 794 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 795 | public static ILRetLogical tological(ILInArray< double > X) {
|
---|
| 796 | return new ILRetLogical (convert< double ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 797 | }
|
---|
| 798 | /// <summary>
|
---|
| 799 | /// Convert numeric array to Int32 array
|
---|
| 800 | /// </summary>
|
---|
| 801 | /// <param name="X">Input array </param>
|
---|
| 802 | /// <returns>Int32 array</returns>
|
---|
| 803 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 804 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 805 | public static ILRetArray<Int32> toint32(ILInArray< double > X) {
|
---|
| 806 | return convert< double ,Int32>(X);
|
---|
| 807 | }
|
---|
| 808 | /// <summary>
|
---|
| 809 | /// Convert numeric array to Int64 array
|
---|
| 810 | /// </summary>
|
---|
| 811 | /// <param name="X">Input array </param>
|
---|
| 812 | /// <returns>Int64 array</returns>
|
---|
| 813 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 814 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 815 | public static ILRetArray<Int64> toint64(ILInArray< double > X) {
|
---|
| 816 | return convert< double ,Int64>(X);
|
---|
| 817 | }
|
---|
| 818 | |
---|
| 819 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 820 | |
---|
| 821 | /// <summary>
|
---|
| 822 | /// Convert numeric array to double array
|
---|
| 823 | /// </summary>
|
---|
| 824 | /// <param name="X">Input array</param>
|
---|
| 825 | /// <returns>double array</returns>
|
---|
| 826 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 827 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 828 | public static ILRetArray<double> todouble(ILInArray< Int64 > X) {
|
---|
| 829 | return convert< Int64 ,double>(X);
|
---|
| 830 | }
|
---|
| 831 | /// <summary>
|
---|
| 832 | /// Convert numeric array to float array
|
---|
| 833 | /// </summary>
|
---|
| 834 | /// <param name="X">Input array</param>
|
---|
| 835 | /// <returns>float array</returns>
|
---|
| 836 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 837 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 838 | public static ILRetArray<float> tosingle(ILInArray< Int64 > X) {
|
---|
| 839 | return convert< Int64 ,float>(X);
|
---|
| 840 | }
|
---|
| 841 | /// <summary>
|
---|
| 842 | /// Convert numeric array to complex array
|
---|
| 843 | /// </summary>
|
---|
| 844 | /// <param name="X">Input array </param>
|
---|
| 845 | /// <returns>complex array</returns>
|
---|
| 846 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 847 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 848 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 849 | public static ILRetArray<complex> tocomplex(ILInArray< Int64 > X) {
|
---|
| 850 | return convert< Int64 ,complex>(X);
|
---|
| 851 | }
|
---|
| 852 | /// <summary>
|
---|
| 853 | /// Convert numeric array to fcomplex array
|
---|
| 854 | /// </summary>
|
---|
| 855 | /// <param name="X">Input array </param>
|
---|
| 856 | /// <returns>fcomplex array</returns>
|
---|
| 857 | /// <remarks>
|
---|
| 858 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 859 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 860 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 861 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< Int64 > X) {
|
---|
| 862 | return convert< Int64 ,fcomplex>(X);
|
---|
| 863 | }
|
---|
| 864 | /// <summary>
|
---|
| 865 | /// Convert numeric array to byte array
|
---|
| 866 | /// </summary>
|
---|
| 867 | /// <param name="X">Input array </param>
|
---|
| 868 | /// <returns>byte array</returns>
|
---|
| 869 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 870 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 871 | public static ILRetArray<byte> tobyte(ILInArray< Int64 > X) {
|
---|
| 872 | return convert< Int64 ,byte>(X);
|
---|
| 873 | }
|
---|
| 874 | /// <summary>
|
---|
| 875 | /// Convert numeric array to logical array
|
---|
| 876 | /// </summary>
|
---|
| 877 | /// <param name="X">Input array </param>
|
---|
| 878 | /// <returns>Logical array</returns>
|
---|
| 879 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 880 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 881 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 882 | public static ILRetLogical tological(ILInArray< Int64 > X) {
|
---|
| 883 | return new ILRetLogical (convert< Int64 ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 884 | }
|
---|
| 885 | /// <summary>
|
---|
| 886 | /// Convert numeric array to Int32 array
|
---|
| 887 | /// </summary>
|
---|
| 888 | /// <param name="X">Input array </param>
|
---|
| 889 | /// <returns>Int32 array</returns>
|
---|
| 890 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 891 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 892 | public static ILRetArray<Int32> toint32(ILInArray< Int64 > X) {
|
---|
| 893 | return convert< Int64 ,Int32>(X);
|
---|
| 894 | }
|
---|
| 895 | /// <summary>
|
---|
| 896 | /// Convert numeric array to Int64 array
|
---|
| 897 | /// </summary>
|
---|
| 898 | /// <param name="X">Input array </param>
|
---|
| 899 | /// <returns>Int64 array</returns>
|
---|
| 900 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 901 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 902 | public static ILRetArray<Int64> toint64(ILInArray< Int64 > X) {
|
---|
| 903 | return convert< Int64 ,Int64>(X);
|
---|
| 904 | }
|
---|
| 905 | /// <summary>
|
---|
| 906 | /// Convert numeric array to double array
|
---|
| 907 | /// </summary>
|
---|
| 908 | /// <param name="X">Input array</param>
|
---|
| 909 | /// <returns>double array</returns>
|
---|
| 910 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 911 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 912 | public static ILRetArray<double> todouble(ILInArray< Int32 > X) {
|
---|
| 913 | return convert< Int32 ,double>(X);
|
---|
| 914 | }
|
---|
| 915 | /// <summary>
|
---|
| 916 | /// Convert numeric array to float array
|
---|
| 917 | /// </summary>
|
---|
| 918 | /// <param name="X">Input array</param>
|
---|
| 919 | /// <returns>float array</returns>
|
---|
| 920 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 921 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 922 | public static ILRetArray<float> tosingle(ILInArray< Int32 > X) {
|
---|
| 923 | return convert< Int32 ,float>(X);
|
---|
| 924 | }
|
---|
| 925 | /// <summary>
|
---|
| 926 | /// Convert numeric array to complex array
|
---|
| 927 | /// </summary>
|
---|
| 928 | /// <param name="X">Input array </param>
|
---|
| 929 | /// <returns>complex array</returns>
|
---|
| 930 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 931 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 932 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 933 | public static ILRetArray<complex> tocomplex(ILInArray< Int32 > X) {
|
---|
| 934 | return convert< Int32 ,complex>(X);
|
---|
| 935 | }
|
---|
| 936 | /// <summary>
|
---|
| 937 | /// Convert numeric array to fcomplex array
|
---|
| 938 | /// </summary>
|
---|
| 939 | /// <param name="X">Input array </param>
|
---|
| 940 | /// <returns>fcomplex array</returns>
|
---|
| 941 | /// <remarks>
|
---|
| 942 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 943 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 944 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 945 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< Int32 > X) {
|
---|
| 946 | return convert< Int32 ,fcomplex>(X);
|
---|
| 947 | }
|
---|
| 948 | /// <summary>
|
---|
| 949 | /// Convert numeric array to byte array
|
---|
| 950 | /// </summary>
|
---|
| 951 | /// <param name="X">Input array </param>
|
---|
| 952 | /// <returns>byte array</returns>
|
---|
| 953 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 954 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 955 | public static ILRetArray<byte> tobyte(ILInArray< Int32 > X) {
|
---|
| 956 | return convert< Int32 ,byte>(X);
|
---|
| 957 | }
|
---|
| 958 | /// <summary>
|
---|
| 959 | /// Convert numeric array to logical array
|
---|
| 960 | /// </summary>
|
---|
| 961 | /// <param name="X">Input array </param>
|
---|
| 962 | /// <returns>Logical array</returns>
|
---|
| 963 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 964 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 965 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 966 | public static ILRetLogical tological(ILInArray< Int32 > X) {
|
---|
| 967 | return new ILRetLogical (convert< Int32 ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 968 | }
|
---|
| 969 | /// <summary>
|
---|
| 970 | /// Convert numeric array to Int32 array
|
---|
| 971 | /// </summary>
|
---|
| 972 | /// <param name="X">Input array </param>
|
---|
| 973 | /// <returns>Int32 array</returns>
|
---|
| 974 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 975 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 976 | public static ILRetArray<Int32> toint32(ILInArray< Int32 > X) {
|
---|
| 977 | return convert< Int32 ,Int32>(X);
|
---|
| 978 | }
|
---|
| 979 | /// <summary>
|
---|
| 980 | /// Convert numeric array to Int64 array
|
---|
| 981 | /// </summary>
|
---|
| 982 | /// <param name="X">Input array </param>
|
---|
| 983 | /// <returns>Int64 array</returns>
|
---|
| 984 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 985 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 986 | public static ILRetArray<Int64> toint64(ILInArray< Int32 > X) {
|
---|
| 987 | return convert< Int32 ,Int64>(X);
|
---|
| 988 | }
|
---|
| 989 | /// <summary>
|
---|
| 990 | /// Convert numeric array to double array
|
---|
| 991 | /// </summary>
|
---|
| 992 | /// <param name="X">Input array</param>
|
---|
| 993 | /// <returns>double array</returns>
|
---|
| 994 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 995 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 996 | public static ILRetArray<double> todouble(ILInArray< byte > X) {
|
---|
| 997 | return convert< byte ,double>(X);
|
---|
| 998 | }
|
---|
| 999 | /// <summary>
|
---|
| 1000 | /// Convert numeric array to float array
|
---|
| 1001 | /// </summary>
|
---|
| 1002 | /// <param name="X">Input array</param>
|
---|
| 1003 | /// <returns>float array</returns>
|
---|
| 1004 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 1005 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1006 | public static ILRetArray<float> tosingle(ILInArray< byte > X) {
|
---|
| 1007 | return convert< byte ,float>(X);
|
---|
| 1008 | }
|
---|
| 1009 | /// <summary>
|
---|
| 1010 | /// Convert numeric array to complex array
|
---|
| 1011 | /// </summary>
|
---|
| 1012 | /// <param name="X">Input array </param>
|
---|
| 1013 | /// <returns>complex array</returns>
|
---|
| 1014 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 1015 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 1016 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1017 | public static ILRetArray<complex> tocomplex(ILInArray< byte > X) {
|
---|
| 1018 | return convert< byte ,complex>(X);
|
---|
| 1019 | }
|
---|
| 1020 | /// <summary>
|
---|
| 1021 | /// Convert numeric array to fcomplex array
|
---|
| 1022 | /// </summary>
|
---|
| 1023 | /// <param name="X">Input array </param>
|
---|
| 1024 | /// <returns>fcomplex array</returns>
|
---|
| 1025 | /// <remarks>
|
---|
| 1026 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 1027 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 1028 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1029 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< byte > X) {
|
---|
| 1030 | return convert< byte ,fcomplex>(X);
|
---|
| 1031 | }
|
---|
| 1032 | /// <summary>
|
---|
| 1033 | /// Convert numeric array to byte array
|
---|
| 1034 | /// </summary>
|
---|
| 1035 | /// <param name="X">Input array </param>
|
---|
| 1036 | /// <returns>byte array</returns>
|
---|
| 1037 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 1038 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1039 | public static ILRetArray<byte> tobyte(ILInArray< byte > X) {
|
---|
| 1040 | return convert< byte ,byte>(X);
|
---|
| 1041 | }
|
---|
| 1042 | /// <summary>
|
---|
| 1043 | /// Convert numeric array to logical array
|
---|
| 1044 | /// </summary>
|
---|
| 1045 | /// <param name="X">Input array </param>
|
---|
| 1046 | /// <returns>Logical array</returns>
|
---|
| 1047 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 1048 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 1049 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1050 | public static ILRetLogical tological(ILInArray< byte > X) {
|
---|
| 1051 | return new ILRetLogical (convert< byte ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 1052 | }
|
---|
| 1053 | /// <summary>
|
---|
| 1054 | /// Convert numeric array to Int32 array
|
---|
| 1055 | /// </summary>
|
---|
| 1056 | /// <param name="X">Input array </param>
|
---|
| 1057 | /// <returns>Int32 array</returns>
|
---|
| 1058 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 1059 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1060 | public static ILRetArray<Int32> toint32(ILInArray< byte > X) {
|
---|
| 1061 | return convert< byte ,Int32>(X);
|
---|
| 1062 | }
|
---|
| 1063 | /// <summary>
|
---|
| 1064 | /// Convert numeric array to Int64 array
|
---|
| 1065 | /// </summary>
|
---|
| 1066 | /// <param name="X">Input array </param>
|
---|
| 1067 | /// <returns>Int64 array</returns>
|
---|
| 1068 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 1069 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1070 | public static ILRetArray<Int64> toint64(ILInArray< byte > X) {
|
---|
| 1071 | return convert< byte ,Int64>(X);
|
---|
| 1072 | }
|
---|
| 1073 | /// <summary>
|
---|
| 1074 | /// Convert numeric array to double array
|
---|
| 1075 | /// </summary>
|
---|
| 1076 | /// <param name="X">Input array</param>
|
---|
| 1077 | /// <returns>double array</returns>
|
---|
| 1078 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 1079 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1080 | public static ILRetArray<double> todouble(ILInArray< fcomplex > X) {
|
---|
| 1081 | return convert< fcomplex ,double>(X);
|
---|
| 1082 | }
|
---|
| 1083 | /// <summary>
|
---|
| 1084 | /// Convert numeric array to float array
|
---|
| 1085 | /// </summary>
|
---|
| 1086 | /// <param name="X">Input array</param>
|
---|
| 1087 | /// <returns>float array</returns>
|
---|
| 1088 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 1089 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1090 | public static ILRetArray<float> tosingle(ILInArray< fcomplex > X) {
|
---|
| 1091 | return convert< fcomplex ,float>(X);
|
---|
| 1092 | }
|
---|
| 1093 | /// <summary>
|
---|
| 1094 | /// Convert numeric array to complex array
|
---|
| 1095 | /// </summary>
|
---|
| 1096 | /// <param name="X">Input array </param>
|
---|
| 1097 | /// <returns>complex array</returns>
|
---|
| 1098 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 1099 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 1100 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1101 | public static ILRetArray<complex> tocomplex(ILInArray< fcomplex > X) {
|
---|
| 1102 | return convert< fcomplex ,complex>(X);
|
---|
| 1103 | }
|
---|
| 1104 | /// <summary>
|
---|
| 1105 | /// Convert numeric array to fcomplex array
|
---|
| 1106 | /// </summary>
|
---|
| 1107 | /// <param name="X">Input array </param>
|
---|
| 1108 | /// <returns>fcomplex array</returns>
|
---|
| 1109 | /// <remarks>
|
---|
| 1110 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 1111 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 1112 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1113 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< fcomplex > X) {
|
---|
| 1114 | return convert< fcomplex ,fcomplex>(X);
|
---|
| 1115 | }
|
---|
| 1116 | /// <summary>
|
---|
| 1117 | /// Convert numeric array to byte array
|
---|
| 1118 | /// </summary>
|
---|
| 1119 | /// <param name="X">Input array </param>
|
---|
| 1120 | /// <returns>byte array</returns>
|
---|
| 1121 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 1122 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1123 | public static ILRetArray<byte> tobyte(ILInArray< fcomplex > X) {
|
---|
| 1124 | return convert< fcomplex ,byte>(X);
|
---|
| 1125 | }
|
---|
| 1126 | /// <summary>
|
---|
| 1127 | /// Convert numeric array to logical array
|
---|
| 1128 | /// </summary>
|
---|
| 1129 | /// <param name="X">Input array </param>
|
---|
| 1130 | /// <returns>Logical array</returns>
|
---|
| 1131 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 1132 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 1133 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1134 | public static ILRetLogical tological(ILInArray< fcomplex > X) {
|
---|
| 1135 | return new ILRetLogical (convert< fcomplex ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 1136 | }
|
---|
| 1137 | /// <summary>
|
---|
| 1138 | /// Convert numeric array to Int32 array
|
---|
| 1139 | /// </summary>
|
---|
| 1140 | /// <param name="X">Input array </param>
|
---|
| 1141 | /// <returns>Int32 array</returns>
|
---|
| 1142 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 1143 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1144 | public static ILRetArray<Int32> toint32(ILInArray< fcomplex > X) {
|
---|
| 1145 | return convert< fcomplex ,Int32>(X);
|
---|
| 1146 | }
|
---|
| 1147 | /// <summary>
|
---|
| 1148 | /// Convert numeric array to Int64 array
|
---|
| 1149 | /// </summary>
|
---|
| 1150 | /// <param name="X">Input array </param>
|
---|
| 1151 | /// <returns>Int64 array</returns>
|
---|
| 1152 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 1153 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1154 | public static ILRetArray<Int64> toint64(ILInArray< fcomplex > X) {
|
---|
| 1155 | return convert< fcomplex ,Int64>(X);
|
---|
| 1156 | }
|
---|
| 1157 | /// <summary>
|
---|
| 1158 | /// Convert numeric array to double array
|
---|
| 1159 | /// </summary>
|
---|
| 1160 | /// <param name="X">Input array</param>
|
---|
| 1161 | /// <returns>double array</returns>
|
---|
| 1162 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 1163 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1164 | public static ILRetArray<double> todouble(ILInArray< complex > X) {
|
---|
| 1165 | return convert< complex ,double>(X);
|
---|
| 1166 | }
|
---|
| 1167 | /// <summary>
|
---|
| 1168 | /// Convert numeric array to float array
|
---|
| 1169 | /// </summary>
|
---|
| 1170 | /// <param name="X">Input array</param>
|
---|
| 1171 | /// <returns>float array</returns>
|
---|
| 1172 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 1173 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1174 | public static ILRetArray<float> tosingle(ILInArray< complex > X) {
|
---|
| 1175 | return convert< complex ,float>(X);
|
---|
| 1176 | }
|
---|
| 1177 | /// <summary>
|
---|
| 1178 | /// Convert numeric array to complex array
|
---|
| 1179 | /// </summary>
|
---|
| 1180 | /// <param name="X">Input array </param>
|
---|
| 1181 | /// <returns>complex array</returns>
|
---|
| 1182 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 1183 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 1184 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1185 | public static ILRetArray<complex> tocomplex(ILInArray< complex > X) {
|
---|
| 1186 | return convert< complex ,complex>(X);
|
---|
| 1187 | }
|
---|
| 1188 | /// <summary>
|
---|
| 1189 | /// Convert numeric array to fcomplex array
|
---|
| 1190 | /// </summary>
|
---|
| 1191 | /// <param name="X">Input array </param>
|
---|
| 1192 | /// <returns>fcomplex array</returns>
|
---|
| 1193 | /// <remarks>
|
---|
| 1194 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 1195 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 1196 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1197 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< complex > X) {
|
---|
| 1198 | return convert< complex ,fcomplex>(X);
|
---|
| 1199 | }
|
---|
| 1200 | /// <summary>
|
---|
| 1201 | /// Convert numeric array to byte array
|
---|
| 1202 | /// </summary>
|
---|
| 1203 | /// <param name="X">Input array </param>
|
---|
| 1204 | /// <returns>byte array</returns>
|
---|
| 1205 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 1206 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1207 | public static ILRetArray<byte> tobyte(ILInArray< complex > X) {
|
---|
| 1208 | return convert< complex ,byte>(X);
|
---|
| 1209 | }
|
---|
| 1210 | /// <summary>
|
---|
| 1211 | /// Convert numeric array to logical array
|
---|
| 1212 | /// </summary>
|
---|
| 1213 | /// <param name="X">Input array </param>
|
---|
| 1214 | /// <returns>Logical array</returns>
|
---|
| 1215 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 1216 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 1217 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1218 | public static ILRetLogical tological(ILInArray< complex > X) {
|
---|
| 1219 | return new ILRetLogical (convert< complex ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 1220 | }
|
---|
| 1221 | /// <summary>
|
---|
| 1222 | /// Convert numeric array to Int32 array
|
---|
| 1223 | /// </summary>
|
---|
| 1224 | /// <param name="X">Input array </param>
|
---|
| 1225 | /// <returns>Int32 array</returns>
|
---|
| 1226 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 1227 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1228 | public static ILRetArray<Int32> toint32(ILInArray< complex > X) {
|
---|
| 1229 | return convert< complex ,Int32>(X);
|
---|
| 1230 | }
|
---|
| 1231 | /// <summary>
|
---|
| 1232 | /// Convert numeric array to Int64 array
|
---|
| 1233 | /// </summary>
|
---|
| 1234 | /// <param name="X">Input array </param>
|
---|
| 1235 | /// <returns>Int64 array</returns>
|
---|
| 1236 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 1237 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1238 | public static ILRetArray<Int64> toint64(ILInArray< complex > X) {
|
---|
| 1239 | return convert< complex ,Int64>(X);
|
---|
| 1240 | }
|
---|
| 1241 | /// <summary>
|
---|
| 1242 | /// Convert numeric array to double array
|
---|
| 1243 | /// </summary>
|
---|
| 1244 | /// <param name="X">Input array</param>
|
---|
| 1245 | /// <returns>double array</returns>
|
---|
| 1246 | /// <remarks><para>The function converts elements of X to double using standard explicit system conversions.
|
---|
| 1247 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1248 | public static ILRetArray<double> todouble(ILInArray< float > X) {
|
---|
| 1249 | return convert< float ,double>(X);
|
---|
| 1250 | }
|
---|
| 1251 | /// <summary>
|
---|
| 1252 | /// Convert numeric array to float array
|
---|
| 1253 | /// </summary>
|
---|
| 1254 | /// <param name="X">Input array</param>
|
---|
| 1255 | /// <returns>float array</returns>
|
---|
| 1256 | /// <remarks><para>The new array converts elements of X to float using standard explicit system conversions.
|
---|
| 1257 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1258 | public static ILRetArray<float> tosingle(ILInArray< float > X) {
|
---|
| 1259 | return convert< float ,float>(X);
|
---|
| 1260 | }
|
---|
| 1261 | /// <summary>
|
---|
| 1262 | /// Convert numeric array to complex array
|
---|
| 1263 | /// </summary>
|
---|
| 1264 | /// <param name="X">Input array </param>
|
---|
| 1265 | /// <returns>complex array</returns>
|
---|
| 1266 | /// <remarks><para>Real input arrays will be converted to the real part of the complex array returned.</para>
|
---|
| 1267 | /// <para>The function converts elements of X to complex using standard explicit system conversions.
|
---|
| 1268 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1269 | public static ILRetArray<complex> tocomplex(ILInArray< float > X) {
|
---|
| 1270 | return convert< float ,complex>(X);
|
---|
| 1271 | }
|
---|
| 1272 | /// <summary>
|
---|
| 1273 | /// Convert numeric array to fcomplex array
|
---|
| 1274 | /// </summary>
|
---|
| 1275 | /// <param name="X">Input array </param>
|
---|
| 1276 | /// <returns>fcomplex array</returns>
|
---|
| 1277 | /// <remarks>
|
---|
| 1278 | /// <para>Real input arrays are converted to the real part of the complex array returned.</para>
|
---|
| 1279 | /// <para>The function converts elements of X to fcomplex using standard explicit system conversions.
|
---|
| 1280 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1281 | public static ILRetArray<fcomplex> tofcomplex(ILInArray< float > X) {
|
---|
| 1282 | return convert< float ,fcomplex>(X);
|
---|
| 1283 | }
|
---|
| 1284 | /// <summary>
|
---|
| 1285 | /// Convert numeric array to byte array
|
---|
| 1286 | /// </summary>
|
---|
| 1287 | /// <param name="X">Input array </param>
|
---|
| 1288 | /// <returns>byte array</returns>
|
---|
| 1289 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions.
|
---|
| 1290 | /// The new array uses new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1291 | public static ILRetArray<byte> tobyte(ILInArray< float > X) {
|
---|
| 1292 | return convert< float ,byte>(X);
|
---|
| 1293 | }
|
---|
| 1294 | /// <summary>
|
---|
| 1295 | /// Convert numeric array to logical array
|
---|
| 1296 | /// </summary>
|
---|
| 1297 | /// <param name="X">Input array </param>
|
---|
| 1298 | /// <returns>Logical array</returns>
|
---|
| 1299 | /// <remarks><para>The function converts elements of X to byte using standard explicit system conversions. Non-zero
|
---|
| 1300 | /// elements are converted to true, zero-elements are converted to false.
|
---|
| 1301 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1302 | public static ILRetLogical tological(ILInArray< float > X) {
|
---|
| 1303 | return new ILRetLogical (convert< float ,byte>(X).Storage as ILDenseStorage<byte>);
|
---|
| 1304 | }
|
---|
| 1305 | /// <summary>
|
---|
| 1306 | /// Convert numeric array to Int32 array
|
---|
| 1307 | /// </summary>
|
---|
| 1308 | /// <param name="X">Input array </param>
|
---|
| 1309 | /// <returns>Int32 array</returns>
|
---|
| 1310 | /// <remarks><para>The function converts elements of X to Int32 using standard explicit system conversions.
|
---|
| 1311 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1312 | public static ILRetArray<Int32> toint32(ILInArray< float > X) {
|
---|
| 1313 | return convert< float ,Int32>(X);
|
---|
| 1314 | }
|
---|
| 1315 | /// <summary>
|
---|
| 1316 | /// Convert numeric array to Int64 array
|
---|
| 1317 | /// </summary>
|
---|
| 1318 | /// <param name="X">Input array </param>
|
---|
| 1319 | /// <returns>Int64 array</returns>
|
---|
| 1320 | /// <remarks><para>The function converts elements of X to Int64 using standard explicit system conversions.
|
---|
| 1321 | /// The new array will always use new memory, even if the incoming type is the same as the output type.</para></remarks>
|
---|
| 1322 | public static ILRetArray<Int64> toint64(ILInArray< float > X) {
|
---|
| 1323 | return convert< float ,Int64>(X);
|
---|
| 1324 | }
|
---|
| 1325 |
|
---|
| 1326 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 1327 |
|
---|
| 1328 | |
---|
| 1329 |
|
---|
| 1330 | /// <summary>
|
---|
| 1331 | /// convert arbitrary numeric array to double array
|
---|
| 1332 | /// </summary>
|
---|
| 1333 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1334 | /// <returns>double array</returns>
|
---|
| 1335 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1336 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1337 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1338 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1339 | /// arrays have the same element type.</para>
|
---|
| 1340 | /// </remarks>
|
---|
| 1341 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1342 | /// not of any supported numeric type</exception>
|
---|
| 1343 | public static ILRetArray< double> todouble(ILBaseArray X) {
|
---|
| 1344 | using (ILScope.Enter(X)) {
|
---|
| 1345 | if (X is ILDenseArray<double>)
|
---|
| 1346 | return convert<double, double>((X as ILDenseArray<double>).C);
|
---|
| 1347 | else if (X is ILDenseArray<float>)
|
---|
| 1348 | return convert<float, double>((X as ILDenseArray<float>).C);
|
---|
| 1349 | else if (X is ILDenseArray<complex>)
|
---|
| 1350 | return convert<complex, double>((X as ILDenseArray<complex>).C);
|
---|
| 1351 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1352 | return convert<fcomplex, double>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1353 | else if (X is ILDenseArray<byte>)
|
---|
| 1354 | return convert<byte, double>((X as ILDenseArray<byte>).C);
|
---|
| 1355 | else if (X is ILDenseArray<Int32>)
|
---|
| 1356 | return convert<Int32, double>((X as ILDenseArray<Int32>).C);
|
---|
| 1357 | else if (X is ILDenseArray<Int64>)
|
---|
| 1358 | return convert<Int64, double>((X as ILDenseArray<Int64>).C);
|
---|
| 1359 | else
|
---|
| 1360 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1361 | }
|
---|
| 1362 | }
|
---|
| 1363 | |
---|
| 1364 | #region HYCALPER AUTO GENERATED CODE
|
---|
| 1365 | |
---|
| 1366 |
|
---|
| 1367 | /// <summary>convert arbitrary numeric array to Int64 array</summary>
|
---|
| 1368 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1369 | /// <returns>Int64 array</returns>
|
---|
| 1370 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1371 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1372 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1373 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1374 | /// arrays have the same element type.</para>
|
---|
| 1375 | /// </remarks>
|
---|
| 1376 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1377 | /// not of any supported numeric type</exception>
|
---|
| 1378 | public static ILRetArray< Int64> toint64(ILBaseArray X) {
|
---|
| 1379 | using (ILScope.Enter(X)) {
|
---|
| 1380 | if (X is ILDenseArray<double>)
|
---|
| 1381 | return convert<double, Int64>((X as ILDenseArray<double>).C);
|
---|
| 1382 | else if (X is ILDenseArray<float>)
|
---|
| 1383 | return convert<float, Int64>((X as ILDenseArray<float>).C);
|
---|
| 1384 | else if (X is ILDenseArray<complex>)
|
---|
| 1385 | return convert<complex, Int64>((X as ILDenseArray<complex>).C);
|
---|
| 1386 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1387 | return convert<fcomplex, Int64>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1388 | else if (X is ILDenseArray<byte>)
|
---|
| 1389 | return convert<byte, Int64>((X as ILDenseArray<byte>).C);
|
---|
| 1390 | else if (X is ILDenseArray<Int32>)
|
---|
| 1391 | return convert<Int32, Int64>((X as ILDenseArray<Int32>).C);
|
---|
| 1392 | else if (X is ILDenseArray<Int64>)
|
---|
| 1393 | return convert<Int64, Int64>((X as ILDenseArray<Int64>).C);
|
---|
| 1394 | else
|
---|
| 1395 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1396 | }
|
---|
| 1397 | }
|
---|
| 1398 |
|
---|
| 1399 | /// <summary>convert arbitrary numeric array to Int32 array</summary>
|
---|
| 1400 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1401 | /// <returns>Int32 array</returns>
|
---|
| 1402 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1403 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1404 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1405 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1406 | /// arrays have the same element type.</para>
|
---|
| 1407 | /// </remarks>
|
---|
| 1408 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1409 | /// not of any supported numeric type</exception>
|
---|
| 1410 | public static ILRetArray< Int32> toint32(ILBaseArray X) {
|
---|
| 1411 | using (ILScope.Enter(X)) {
|
---|
| 1412 | if (X is ILDenseArray<double>)
|
---|
| 1413 | return convert<double, Int32>((X as ILDenseArray<double>).C);
|
---|
| 1414 | else if (X is ILDenseArray<float>)
|
---|
| 1415 | return convert<float, Int32>((X as ILDenseArray<float>).C);
|
---|
| 1416 | else if (X is ILDenseArray<complex>)
|
---|
| 1417 | return convert<complex, Int32>((X as ILDenseArray<complex>).C);
|
---|
| 1418 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1419 | return convert<fcomplex, Int32>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1420 | else if (X is ILDenseArray<byte>)
|
---|
| 1421 | return convert<byte, Int32>((X as ILDenseArray<byte>).C);
|
---|
| 1422 | else if (X is ILDenseArray<Int32>)
|
---|
| 1423 | return convert<Int32, Int32>((X as ILDenseArray<Int32>).C);
|
---|
| 1424 | else if (X is ILDenseArray<Int64>)
|
---|
| 1425 | return convert<Int64, Int32>((X as ILDenseArray<Int64>).C);
|
---|
| 1426 | else
|
---|
| 1427 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1428 | }
|
---|
| 1429 | }
|
---|
| 1430 |
|
---|
| 1431 | /// <summary>convert arbitrary numeric array to byte array</summary>
|
---|
| 1432 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1433 | /// <returns>byte array</returns>
|
---|
| 1434 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1435 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1436 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1437 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1438 | /// arrays have the same element type.</para>
|
---|
| 1439 | /// </remarks>
|
---|
| 1440 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1441 | /// not of any supported numeric type</exception>
|
---|
| 1442 | public static ILRetArray< byte> tobyte(ILBaseArray X) {
|
---|
| 1443 | using (ILScope.Enter(X)) {
|
---|
| 1444 | if (X is ILDenseArray<double>)
|
---|
| 1445 | return convert<double, byte>((X as ILDenseArray<double>).C);
|
---|
| 1446 | else if (X is ILDenseArray<float>)
|
---|
| 1447 | return convert<float, byte>((X as ILDenseArray<float>).C);
|
---|
| 1448 | else if (X is ILDenseArray<complex>)
|
---|
| 1449 | return convert<complex, byte>((X as ILDenseArray<complex>).C);
|
---|
| 1450 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1451 | return convert<fcomplex, byte>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1452 | else if (X is ILDenseArray<byte>)
|
---|
| 1453 | return convert<byte, byte>((X as ILDenseArray<byte>).C);
|
---|
| 1454 | else if (X is ILDenseArray<Int32>)
|
---|
| 1455 | return convert<Int32, byte>((X as ILDenseArray<Int32>).C);
|
---|
| 1456 | else if (X is ILDenseArray<Int64>)
|
---|
| 1457 | return convert<Int64, byte>((X as ILDenseArray<Int64>).C);
|
---|
| 1458 | else
|
---|
| 1459 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1460 | }
|
---|
| 1461 | }
|
---|
| 1462 |
|
---|
| 1463 | /// <summary>convert arbitrary numeric array to fcomplex array</summary>
|
---|
| 1464 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1465 | /// <returns>fcomplex array</returns>
|
---|
| 1466 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1467 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1468 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1469 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1470 | /// arrays have the same element type.</para>
|
---|
| 1471 | /// </remarks>
|
---|
| 1472 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1473 | /// not of any supported numeric type</exception>
|
---|
| 1474 | public static ILRetArray< fcomplex> tofcomplex(ILBaseArray X) {
|
---|
| 1475 | using (ILScope.Enter(X)) {
|
---|
| 1476 | if (X is ILDenseArray<double>)
|
---|
| 1477 | return convert<double, fcomplex>((X as ILDenseArray<double>).C);
|
---|
| 1478 | else if (X is ILDenseArray<float>)
|
---|
| 1479 | return convert<float, fcomplex>((X as ILDenseArray<float>).C);
|
---|
| 1480 | else if (X is ILDenseArray<complex>)
|
---|
| 1481 | return convert<complex, fcomplex>((X as ILDenseArray<complex>).C);
|
---|
| 1482 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1483 | return convert<fcomplex, fcomplex>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1484 | else if (X is ILDenseArray<byte>)
|
---|
| 1485 | return convert<byte, fcomplex>((X as ILDenseArray<byte>).C);
|
---|
| 1486 | else if (X is ILDenseArray<Int32>)
|
---|
| 1487 | return convert<Int32, fcomplex>((X as ILDenseArray<Int32>).C);
|
---|
| 1488 | else if (X is ILDenseArray<Int64>)
|
---|
| 1489 | return convert<Int64, fcomplex>((X as ILDenseArray<Int64>).C);
|
---|
| 1490 | else
|
---|
| 1491 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1492 | }
|
---|
| 1493 | }
|
---|
| 1494 |
|
---|
| 1495 | /// <summary>convert arbitrary numeric array to complex array</summary>
|
---|
| 1496 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1497 | /// <returns>complex array</returns>
|
---|
| 1498 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1499 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1500 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1501 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1502 | /// arrays have the same element type.</para>
|
---|
| 1503 | /// </remarks>
|
---|
| 1504 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1505 | /// not of any supported numeric type</exception>
|
---|
| 1506 | public static ILRetArray< complex> tocomplex(ILBaseArray X) {
|
---|
| 1507 | using (ILScope.Enter(X)) {
|
---|
| 1508 | if (X is ILDenseArray<double>)
|
---|
| 1509 | return convert<double, complex>((X as ILDenseArray<double>).C);
|
---|
| 1510 | else if (X is ILDenseArray<float>)
|
---|
| 1511 | return convert<float, complex>((X as ILDenseArray<float>).C);
|
---|
| 1512 | else if (X is ILDenseArray<complex>)
|
---|
| 1513 | return convert<complex, complex>((X as ILDenseArray<complex>).C);
|
---|
| 1514 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1515 | return convert<fcomplex, complex>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1516 | else if (X is ILDenseArray<byte>)
|
---|
| 1517 | return convert<byte, complex>((X as ILDenseArray<byte>).C);
|
---|
| 1518 | else if (X is ILDenseArray<Int32>)
|
---|
| 1519 | return convert<Int32, complex>((X as ILDenseArray<Int32>).C);
|
---|
| 1520 | else if (X is ILDenseArray<Int64>)
|
---|
| 1521 | return convert<Int64, complex>((X as ILDenseArray<Int64>).C);
|
---|
| 1522 | else
|
---|
| 1523 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1524 | }
|
---|
| 1525 | }
|
---|
| 1526 |
|
---|
| 1527 | /// <summary>convert arbitrary numeric array to float array</summary>
|
---|
| 1528 | /// <param name="X">numeric array, one of supported numeric type</param>
|
---|
| 1529 | /// <returns>float array</returns>
|
---|
| 1530 | /// <remarks>This function enables to convert arbitrary numeric (dense) arrays to a known output array type
|
---|
| 1531 | /// - without knowing the concrete numeric type of the source. Supported element types include: double,
|
---|
| 1532 | /// float, complex, fcomplex, byte, logical, Int32, Int64.
|
---|
| 1533 | /// <para>This function will always create new memory for the new array, even if both
|
---|
| 1534 | /// arrays have the same element type.</para>
|
---|
| 1535 | /// </remarks>
|
---|
| 1536 | /// <exception cref="ILNumerics.Exceptions.ILArgumentException">if elements of X are
|
---|
| 1537 | /// not of any supported numeric type</exception>
|
---|
| 1538 | public static ILRetArray< float> tosingle(ILBaseArray X) {
|
---|
| 1539 | using (ILScope.Enter(X)) {
|
---|
| 1540 | if (X is ILDenseArray<double>)
|
---|
| 1541 | return convert<double, float>((X as ILDenseArray<double>).C);
|
---|
| 1542 | else if (X is ILDenseArray<float>)
|
---|
| 1543 | return convert<float, float>((X as ILDenseArray<float>).C);
|
---|
| 1544 | else if (X is ILDenseArray<complex>)
|
---|
| 1545 | return convert<complex, float>((X as ILDenseArray<complex>).C);
|
---|
| 1546 | else if (X is ILDenseArray<fcomplex>)
|
---|
| 1547 | return convert<fcomplex, float>((X as ILDenseArray<fcomplex>).C);
|
---|
| 1548 | else if (X is ILDenseArray<byte>)
|
---|
| 1549 | return convert<byte, float>((X as ILDenseArray<byte>).C);
|
---|
| 1550 | else if (X is ILDenseArray<Int32>)
|
---|
| 1551 | return convert<Int32, float>((X as ILDenseArray<Int32>).C);
|
---|
| 1552 | else if (X is ILDenseArray<Int64>)
|
---|
| 1553 | return convert<Int64, float>((X as ILDenseArray<Int64>).C);
|
---|
| 1554 | else
|
---|
| 1555 | throw new ILArgumentException("input type not supported: " + X.GetType().Name);
|
---|
| 1556 | }
|
---|
| 1557 | }
|
---|
| 1558 |
|
---|
| 1559 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
| 1560 |
|
---|
| 1561 | }
|
---|
| 1562 |
|
---|
| 1563 | }
|
---|