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;
|
---|
44 | using ILNumerics.Exceptions;
|
---|
45 | using ILNumerics.Storage;
|
---|
46 | using ILNumerics.Misc;
|
---|
47 |
|
---|
48 |
|
---|
49 |
|
---|
50 | namespace ILNumerics {
|
---|
51 |
|
---|
52 | public partial class ILMath {
|
---|
53 |
|
---|
54 | |
---|
55 |
|
---|
56 | |
---|
57 | #region HYCALPER AUTO GENERATED CODE
|
---|
58 | |
---|
59 | /// <summary>Arcsine of array elements - complex output</summary>
|
---|
60 | /// <param name="A">Input array</param>
|
---|
61 | /// <returns>Arcsine of array elements - complex output</returns>
|
---|
62 | /// <remarks><para>If the input array is empty, an empty array will be returned.</para>
|
---|
63 | /// <para>The array returned will be a dense array.</para></remarks>
|
---|
64 | public unsafe static ILRetArray<fcomplex> asinc (ILInArray< float > A) {
|
---|
65 | using (ILScope.Enter(A)) {
|
---|
66 | if (A.IsEmpty)
|
---|
67 | return new ILRetArray<fcomplex>(A.Size);
|
---|
68 | ILSize inDim = A.Size;
|
---|
69 | float[] arrA = A.GetArrayForRead();
|
---|
70 | fcomplex [] retArr;
|
---|
71 | int outLen = inDim.NumberOfElements;
|
---|
72 | bool inplace = true;
|
---|
73 |
|
---|
74 | if (true){
|
---|
75 | retArr = ILMemoryPool.Pool.New<fcomplex>(outLen);
|
---|
76 | inplace = false;
|
---|
77 | }
|
---|
78 | int i = 0, workItemCount = Settings.s_maxNumberThreads, workItemLength, workerCount = 1;
|
---|
79 | if (Settings.s_maxNumberThreads > 1 && outLen / 2 > Settings.s_minParallelElement1Count) {
|
---|
80 | if (outLen / workItemCount > Settings.s_minParallelElement1Count) {
|
---|
81 | workItemLength = outLen / workItemCount;
|
---|
82 | //workItemLength = (int)((double)outLen / workItemCount * 1.05);
|
---|
83 | } else {
|
---|
84 | workItemLength = outLen / 2;
|
---|
85 | workItemCount = 2;
|
---|
86 | }
|
---|
87 | } else {
|
---|
88 | workItemLength = outLen;
|
---|
89 | workItemCount = 1;
|
---|
90 | }
|
---|
91 | ILDenseStorage<fcomplex> retStorage = new ILDenseStorage<fcomplex>(retArr, inDim);
|
---|
92 |
|
---|
93 | Action<object> worker = data => {
|
---|
94 | Tuple<int, int, IntPtr, IntPtr, bool> range = (Tuple<int, int, IntPtr, IntPtr, bool>)data;
|
---|
95 |
|
---|
96 | fcomplex* cp = ((fcomplex*)range.Item4 + range.Item1);
|
---|
97 | int len = range.Item2;
|
---|
98 | if (range.Item5) {
|
---|
99 | // inplace
|
---|
100 | while (len > 20) {
|
---|
101 | cp[0] = fcomplex.Asin(cp[0] ) /*dummy*/;
|
---|
102 | cp[1] = fcomplex.Asin(cp[1] ) /*dummy*/;
|
---|
103 | cp[2] = fcomplex.Asin(cp[2] ) /*dummy*/;
|
---|
104 | cp[3] = fcomplex.Asin(cp[3] ) /*dummy*/;
|
---|
105 | cp[4] = fcomplex.Asin(cp[4] ) /*dummy*/;
|
---|
106 | cp[5] = fcomplex.Asin(cp[5] ) /*dummy*/;
|
---|
107 | cp[6] = fcomplex.Asin(cp[6] ) /*dummy*/;
|
---|
108 | cp[7] = fcomplex.Asin(cp[7] ) /*dummy*/;
|
---|
109 | cp[8] = fcomplex.Asin(cp[8] ) /*dummy*/;
|
---|
110 | cp[9] = fcomplex.Asin(cp[9] ) /*dummy*/;
|
---|
111 | cp[10] = fcomplex.Asin(cp[10] ) /*dummy*/;
|
---|
112 | cp[11] = fcomplex.Asin(cp[11] ) /*dummy*/;
|
---|
113 | cp[12] = fcomplex.Asin(cp[12] ) /*dummy*/;
|
---|
114 | cp[13] = fcomplex.Asin(cp[13] ) /*dummy*/;
|
---|
115 | cp[14] = fcomplex.Asin(cp[14] ) /*dummy*/;
|
---|
116 | cp[15] = fcomplex.Asin(cp[15] ) /*dummy*/;
|
---|
117 | cp[16] = fcomplex.Asin(cp[16] ) /*dummy*/;
|
---|
118 | cp[17] = fcomplex.Asin(cp[17] ) /*dummy*/;
|
---|
119 | cp[18] = fcomplex.Asin(cp[18] ) /*dummy*/;
|
---|
120 | cp[19] = fcomplex.Asin(cp[19] ) /*dummy*/;
|
---|
121 | cp[20] = fcomplex.Asin(cp[20] ) /*dummy*/;
|
---|
122 | cp+=21; len -= 21;
|
---|
123 | }
|
---|
124 | while (len-- > 0) {
|
---|
125 | *cp = fcomplex.Asin(*cp ) /*dummy*/;
|
---|
126 | cp++;
|
---|
127 | }
|
---|
128 | } else {
|
---|
129 | float* ap = ((float*)range.Item3 + range.Item1);
|
---|
130 | while (len > 20) {
|
---|
131 | cp[0] = fcomplex.Asin(ap[0] ) /*dummy*/;
|
---|
132 | cp[1] = fcomplex.Asin(ap[1] ) /*dummy*/;
|
---|
133 | cp[2] = fcomplex.Asin(ap[2] ) /*dummy*/;
|
---|
134 | cp[3] = fcomplex.Asin(ap[3] ) /*dummy*/;
|
---|
135 | cp[4] = fcomplex.Asin(ap[4] ) /*dummy*/;
|
---|
136 | cp[5] = fcomplex.Asin(ap[5] ) /*dummy*/;
|
---|
137 | cp[6] = fcomplex.Asin(ap[6] ) /*dummy*/;
|
---|
138 | cp[7] = fcomplex.Asin(ap[7] ) /*dummy*/;
|
---|
139 | cp[8] = fcomplex.Asin(ap[8] ) /*dummy*/;
|
---|
140 | cp[9] = fcomplex.Asin(ap[9] ) /*dummy*/;
|
---|
141 | cp[10] = fcomplex.Asin(ap[10] ) /*dummy*/;
|
---|
142 | cp[11] = fcomplex.Asin(ap[11] ) /*dummy*/;
|
---|
143 | cp[12] = fcomplex.Asin(ap[12] ) /*dummy*/;
|
---|
144 | cp[13] = fcomplex.Asin(ap[13] ) /*dummy*/;
|
---|
145 | cp[14] = fcomplex.Asin(ap[14] ) /*dummy*/;
|
---|
146 | cp[15] = fcomplex.Asin(ap[15] ) /*dummy*/;
|
---|
147 | cp[16] = fcomplex.Asin(ap[16] ) /*dummy*/;
|
---|
148 | cp[17] = fcomplex.Asin(ap[17] ) /*dummy*/;
|
---|
149 | cp[18] = fcomplex.Asin(ap[18] ) /*dummy*/;
|
---|
150 | cp[19] = fcomplex.Asin(ap[19] ) /*dummy*/;
|
---|
151 | cp[20] = fcomplex.Asin(ap[20] ) /*dummy*/;
|
---|
152 | ap += 21;
|
---|
153 | cp += 21;
|
---|
154 | len -= 21;
|
---|
155 | }
|
---|
156 | while (len-- > 0) {
|
---|
157 | *cp = fcomplex.Asin(*ap ) /*dummy*/;
|
---|
158 | ap++;
|
---|
159 | cp++;
|
---|
160 | }
|
---|
161 | }
|
---|
162 | System.Threading.Interlocked.Decrement(ref workerCount);
|
---|
163 | };
|
---|
164 |
|
---|
165 | fixed ( float* arrAP = arrA)
|
---|
166 | fixed ( fcomplex* retArrP = retArr) {
|
---|
167 | for (; i < workItemCount - 1; i++) {
|
---|
168 | Tuple<int, int, IntPtr, IntPtr, bool> range
|
---|
169 | = new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
170 | (i * workItemLength, workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace);
|
---|
171 | System.Threading.Interlocked.Increment(ref workerCount);
|
---|
172 | ILThreadPool.QueueUserWorkItem(i,worker, range);
|
---|
173 | }
|
---|
174 | // the last (or may the only) chunk is done right here
|
---|
175 | worker(new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
176 | (i * workItemLength, outLen - i * workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace));
|
---|
177 |
|
---|
178 | ILThreadPool.Wait4Workers(ref workerCount);
|
---|
179 | }
|
---|
180 | return new ILRetArray<fcomplex>(retStorage);
|
---|
181 | }
|
---|
182 | }
|
---|
183 | /// <summary>Arcsine of array elements - complex output</summary>
|
---|
184 | /// <param name="A">Input array</param>
|
---|
185 | /// <returns>Arcsine of array elements - complex output</returns>
|
---|
186 | /// <remarks><para>If the input array is empty, an empty array will be returned.</para>
|
---|
187 | /// <para>The array returned will be a dense array.</para></remarks>
|
---|
188 | public unsafe static ILRetArray<complex> asinc (ILInArray< double > A) {
|
---|
189 | using (ILScope.Enter(A)) {
|
---|
190 | if (A.IsEmpty)
|
---|
191 | return new ILRetArray<complex>(A.Size);
|
---|
192 | ILSize inDim = A.Size;
|
---|
193 | double[] arrA = A.GetArrayForRead();
|
---|
194 | complex [] retArr;
|
---|
195 | int outLen = inDim.NumberOfElements;
|
---|
196 | bool inplace = true;
|
---|
197 |
|
---|
198 | if (true){
|
---|
199 | retArr = ILMemoryPool.Pool.New<complex>(outLen);
|
---|
200 | inplace = false;
|
---|
201 | }
|
---|
202 | int i = 0, workItemCount = Settings.s_maxNumberThreads, workItemLength, workerCount = 1;
|
---|
203 | if (Settings.s_maxNumberThreads > 1 && outLen / 2 > Settings.s_minParallelElement1Count) {
|
---|
204 | if (outLen / workItemCount > Settings.s_minParallelElement1Count) {
|
---|
205 | workItemLength = outLen / workItemCount;
|
---|
206 | //workItemLength = (int)((double)outLen / workItemCount * 1.05);
|
---|
207 | } else {
|
---|
208 | workItemLength = outLen / 2;
|
---|
209 | workItemCount = 2;
|
---|
210 | }
|
---|
211 | } else {
|
---|
212 | workItemLength = outLen;
|
---|
213 | workItemCount = 1;
|
---|
214 | }
|
---|
215 | ILDenseStorage<complex> retStorage = new ILDenseStorage<complex>(retArr, inDim);
|
---|
216 |
|
---|
217 | Action<object> worker = data => {
|
---|
218 | Tuple<int, int, IntPtr, IntPtr, bool> range = (Tuple<int, int, IntPtr, IntPtr, bool>)data;
|
---|
219 |
|
---|
220 | complex* cp = ((complex*)range.Item4 + range.Item1);
|
---|
221 | int len = range.Item2;
|
---|
222 | if (range.Item5) {
|
---|
223 | // inplace
|
---|
224 | while (len > 20) {
|
---|
225 | cp[0] = complex.Asin(cp[0] ) /*dummy*/;
|
---|
226 | cp[1] = complex.Asin(cp[1] ) /*dummy*/;
|
---|
227 | cp[2] = complex.Asin(cp[2] ) /*dummy*/;
|
---|
228 | cp[3] = complex.Asin(cp[3] ) /*dummy*/;
|
---|
229 | cp[4] = complex.Asin(cp[4] ) /*dummy*/;
|
---|
230 | cp[5] = complex.Asin(cp[5] ) /*dummy*/;
|
---|
231 | cp[6] = complex.Asin(cp[6] ) /*dummy*/;
|
---|
232 | cp[7] = complex.Asin(cp[7] ) /*dummy*/;
|
---|
233 | cp[8] = complex.Asin(cp[8] ) /*dummy*/;
|
---|
234 | cp[9] = complex.Asin(cp[9] ) /*dummy*/;
|
---|
235 | cp[10] = complex.Asin(cp[10] ) /*dummy*/;
|
---|
236 | cp[11] = complex.Asin(cp[11] ) /*dummy*/;
|
---|
237 | cp[12] = complex.Asin(cp[12] ) /*dummy*/;
|
---|
238 | cp[13] = complex.Asin(cp[13] ) /*dummy*/;
|
---|
239 | cp[14] = complex.Asin(cp[14] ) /*dummy*/;
|
---|
240 | cp[15] = complex.Asin(cp[15] ) /*dummy*/;
|
---|
241 | cp[16] = complex.Asin(cp[16] ) /*dummy*/;
|
---|
242 | cp[17] = complex.Asin(cp[17] ) /*dummy*/;
|
---|
243 | cp[18] = complex.Asin(cp[18] ) /*dummy*/;
|
---|
244 | cp[19] = complex.Asin(cp[19] ) /*dummy*/;
|
---|
245 | cp[20] = complex.Asin(cp[20] ) /*dummy*/;
|
---|
246 | cp+=21; len -= 21;
|
---|
247 | }
|
---|
248 | while (len-- > 0) {
|
---|
249 | *cp = complex.Asin(*cp ) /*dummy*/;
|
---|
250 | cp++;
|
---|
251 | }
|
---|
252 | } else {
|
---|
253 | double* ap = ((double*)range.Item3 + range.Item1);
|
---|
254 | while (len > 20) {
|
---|
255 | cp[0] = complex.Asin(ap[0] ) /*dummy*/;
|
---|
256 | cp[1] = complex.Asin(ap[1] ) /*dummy*/;
|
---|
257 | cp[2] = complex.Asin(ap[2] ) /*dummy*/;
|
---|
258 | cp[3] = complex.Asin(ap[3] ) /*dummy*/;
|
---|
259 | cp[4] = complex.Asin(ap[4] ) /*dummy*/;
|
---|
260 | cp[5] = complex.Asin(ap[5] ) /*dummy*/;
|
---|
261 | cp[6] = complex.Asin(ap[6] ) /*dummy*/;
|
---|
262 | cp[7] = complex.Asin(ap[7] ) /*dummy*/;
|
---|
263 | cp[8] = complex.Asin(ap[8] ) /*dummy*/;
|
---|
264 | cp[9] = complex.Asin(ap[9] ) /*dummy*/;
|
---|
265 | cp[10] = complex.Asin(ap[10] ) /*dummy*/;
|
---|
266 | cp[11] = complex.Asin(ap[11] ) /*dummy*/;
|
---|
267 | cp[12] = complex.Asin(ap[12] ) /*dummy*/;
|
---|
268 | cp[13] = complex.Asin(ap[13] ) /*dummy*/;
|
---|
269 | cp[14] = complex.Asin(ap[14] ) /*dummy*/;
|
---|
270 | cp[15] = complex.Asin(ap[15] ) /*dummy*/;
|
---|
271 | cp[16] = complex.Asin(ap[16] ) /*dummy*/;
|
---|
272 | cp[17] = complex.Asin(ap[17] ) /*dummy*/;
|
---|
273 | cp[18] = complex.Asin(ap[18] ) /*dummy*/;
|
---|
274 | cp[19] = complex.Asin(ap[19] ) /*dummy*/;
|
---|
275 | cp[20] = complex.Asin(ap[20] ) /*dummy*/;
|
---|
276 | ap += 21;
|
---|
277 | cp += 21;
|
---|
278 | len -= 21;
|
---|
279 | }
|
---|
280 | while (len-- > 0) {
|
---|
281 | *cp = complex.Asin(*ap ) /*dummy*/;
|
---|
282 | ap++;
|
---|
283 | cp++;
|
---|
284 | }
|
---|
285 | }
|
---|
286 | System.Threading.Interlocked.Decrement(ref workerCount);
|
---|
287 | };
|
---|
288 |
|
---|
289 | fixed ( double* arrAP = arrA)
|
---|
290 | fixed ( complex* retArrP = retArr) {
|
---|
291 | for (; i < workItemCount - 1; i++) {
|
---|
292 | Tuple<int, int, IntPtr, IntPtr, bool> range
|
---|
293 | = new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
294 | (i * workItemLength, workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace);
|
---|
295 | System.Threading.Interlocked.Increment(ref workerCount);
|
---|
296 | ILThreadPool.QueueUserWorkItem(i,worker, range);
|
---|
297 | }
|
---|
298 | // the last (or may the only) chunk is done right here
|
---|
299 | worker(new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
300 | (i * workItemLength, outLen - i * workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace));
|
---|
301 |
|
---|
302 | ILThreadPool.Wait4Workers(ref workerCount);
|
---|
303 | }
|
---|
304 | return new ILRetArray<complex>(retStorage);
|
---|
305 | }
|
---|
306 | }
|
---|
307 | /// <summary>Arcsine values of array elements</summary>
|
---|
308 | /// <param name="A">Input array</param>
|
---|
309 | /// <returns>Arcsine of array elements</returns>
|
---|
310 | /// <remarks><para>If the input array is empty, an empty array will be returned.</para>
|
---|
311 | /// <para>The array returned will be a dense array.</para></remarks>
|
---|
312 | public unsafe static ILRetArray<complex> asin (ILInArray< complex > A) {
|
---|
313 | using (ILScope.Enter(A)) {
|
---|
314 | if (A.IsEmpty)
|
---|
315 | return new ILRetArray<complex>(A.Size);
|
---|
316 | ILSize inDim = A.Size;
|
---|
317 | complex[] arrA = A.GetArrayForRead();
|
---|
318 | complex [] retArr;
|
---|
319 | int outLen = inDim.NumberOfElements;
|
---|
320 | bool inplace = true;
|
---|
321 |
|
---|
322 | if (!A.TryGetStorage4InplaceOp(out retArr)) {
|
---|
323 | retArr = ILMemoryPool.Pool.New<complex>(outLen);
|
---|
324 | inplace = false;
|
---|
325 | }
|
---|
326 | int i = 0, workItemCount = Settings.s_maxNumberThreads, workItemLength, workerCount = 1;
|
---|
327 | if (Settings.s_maxNumberThreads > 1 && outLen / 2 > Settings.s_minParallelElement1Count) {
|
---|
328 | if (outLen / workItemCount > Settings.s_minParallelElement1Count) {
|
---|
329 | workItemLength = outLen / workItemCount;
|
---|
330 | //workItemLength = (int)((double)outLen / workItemCount * 1.05);
|
---|
331 | } else {
|
---|
332 | workItemLength = outLen / 2;
|
---|
333 | workItemCount = 2;
|
---|
334 | }
|
---|
335 | } else {
|
---|
336 | workItemLength = outLen;
|
---|
337 | workItemCount = 1;
|
---|
338 | }
|
---|
339 | ILDenseStorage<complex> retStorage = new ILDenseStorage<complex>(retArr, inDim);
|
---|
340 |
|
---|
341 | Action<object> worker = data => {
|
---|
342 | Tuple<int, int, IntPtr, IntPtr, bool> range = (Tuple<int, int, IntPtr, IntPtr, bool>)data;
|
---|
343 |
|
---|
344 | complex* cp = ((complex*)range.Item4 + range.Item1);
|
---|
345 | int len = range.Item2;
|
---|
346 | if (range.Item5) {
|
---|
347 | // inplace
|
---|
348 | while (len > 20) {
|
---|
349 | cp[0] = complex.Asin(cp[0] ) /*dummy*/;
|
---|
350 | cp[1] = complex.Asin(cp[1] ) /*dummy*/;
|
---|
351 | cp[2] = complex.Asin(cp[2] ) /*dummy*/;
|
---|
352 | cp[3] = complex.Asin(cp[3] ) /*dummy*/;
|
---|
353 | cp[4] = complex.Asin(cp[4] ) /*dummy*/;
|
---|
354 | cp[5] = complex.Asin(cp[5] ) /*dummy*/;
|
---|
355 | cp[6] = complex.Asin(cp[6] ) /*dummy*/;
|
---|
356 | cp[7] = complex.Asin(cp[7] ) /*dummy*/;
|
---|
357 | cp[8] = complex.Asin(cp[8] ) /*dummy*/;
|
---|
358 | cp[9] = complex.Asin(cp[9] ) /*dummy*/;
|
---|
359 | cp[10] = complex.Asin(cp[10] ) /*dummy*/;
|
---|
360 | cp[11] = complex.Asin(cp[11] ) /*dummy*/;
|
---|
361 | cp[12] = complex.Asin(cp[12] ) /*dummy*/;
|
---|
362 | cp[13] = complex.Asin(cp[13] ) /*dummy*/;
|
---|
363 | cp[14] = complex.Asin(cp[14] ) /*dummy*/;
|
---|
364 | cp[15] = complex.Asin(cp[15] ) /*dummy*/;
|
---|
365 | cp[16] = complex.Asin(cp[16] ) /*dummy*/;
|
---|
366 | cp[17] = complex.Asin(cp[17] ) /*dummy*/;
|
---|
367 | cp[18] = complex.Asin(cp[18] ) /*dummy*/;
|
---|
368 | cp[19] = complex.Asin(cp[19] ) /*dummy*/;
|
---|
369 | cp[20] = complex.Asin(cp[20] ) /*dummy*/;
|
---|
370 | cp+=21; len -= 21;
|
---|
371 | }
|
---|
372 | while (len-- > 0) {
|
---|
373 | *cp = complex.Asin(*cp ) /*dummy*/;
|
---|
374 | cp++;
|
---|
375 | }
|
---|
376 | } else {
|
---|
377 | complex* ap = ((complex*)range.Item3 + range.Item1);
|
---|
378 | while (len > 20) {
|
---|
379 | cp[0] = complex.Asin(ap[0] ) /*dummy*/;
|
---|
380 | cp[1] = complex.Asin(ap[1] ) /*dummy*/;
|
---|
381 | cp[2] = complex.Asin(ap[2] ) /*dummy*/;
|
---|
382 | cp[3] = complex.Asin(ap[3] ) /*dummy*/;
|
---|
383 | cp[4] = complex.Asin(ap[4] ) /*dummy*/;
|
---|
384 | cp[5] = complex.Asin(ap[5] ) /*dummy*/;
|
---|
385 | cp[6] = complex.Asin(ap[6] ) /*dummy*/;
|
---|
386 | cp[7] = complex.Asin(ap[7] ) /*dummy*/;
|
---|
387 | cp[8] = complex.Asin(ap[8] ) /*dummy*/;
|
---|
388 | cp[9] = complex.Asin(ap[9] ) /*dummy*/;
|
---|
389 | cp[10] = complex.Asin(ap[10] ) /*dummy*/;
|
---|
390 | cp[11] = complex.Asin(ap[11] ) /*dummy*/;
|
---|
391 | cp[12] = complex.Asin(ap[12] ) /*dummy*/;
|
---|
392 | cp[13] = complex.Asin(ap[13] ) /*dummy*/;
|
---|
393 | cp[14] = complex.Asin(ap[14] ) /*dummy*/;
|
---|
394 | cp[15] = complex.Asin(ap[15] ) /*dummy*/;
|
---|
395 | cp[16] = complex.Asin(ap[16] ) /*dummy*/;
|
---|
396 | cp[17] = complex.Asin(ap[17] ) /*dummy*/;
|
---|
397 | cp[18] = complex.Asin(ap[18] ) /*dummy*/;
|
---|
398 | cp[19] = complex.Asin(ap[19] ) /*dummy*/;
|
---|
399 | cp[20] = complex.Asin(ap[20] ) /*dummy*/;
|
---|
400 | ap += 21;
|
---|
401 | cp += 21;
|
---|
402 | len -= 21;
|
---|
403 | }
|
---|
404 | while (len-- > 0) {
|
---|
405 | *cp = complex.Asin(*ap ) /*dummy*/;
|
---|
406 | ap++;
|
---|
407 | cp++;
|
---|
408 | }
|
---|
409 | }
|
---|
410 | System.Threading.Interlocked.Decrement(ref workerCount);
|
---|
411 | };
|
---|
412 |
|
---|
413 | fixed ( complex* arrAP = arrA)
|
---|
414 | fixed ( complex* retArrP = retArr) {
|
---|
415 | for (; i < workItemCount - 1; i++) {
|
---|
416 | Tuple<int, int, IntPtr, IntPtr, bool> range
|
---|
417 | = new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
418 | (i * workItemLength, workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace);
|
---|
419 | System.Threading.Interlocked.Increment(ref workerCount);
|
---|
420 | ILThreadPool.QueueUserWorkItem(i,worker, range);
|
---|
421 | }
|
---|
422 | // the last (or may the only) chunk is done right here
|
---|
423 | worker(new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
424 | (i * workItemLength, outLen - i * workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace));
|
---|
425 |
|
---|
426 | ILThreadPool.Wait4Workers(ref workerCount);
|
---|
427 | }
|
---|
428 | return new ILRetArray<complex>(retStorage);
|
---|
429 | }
|
---|
430 | }
|
---|
431 | /// <summary>Arcsine values of array elements</summary>
|
---|
432 | /// <param name="A">Input array</param>
|
---|
433 | /// <returns>Arcsine of array elements</returns>
|
---|
434 | /// <remarks><para>If the input array is empty, an empty array will be returned.</para>
|
---|
435 | /// <para>The array returned will be a dense array.</para></remarks>
|
---|
436 | public unsafe static ILRetArray<fcomplex> asin (ILInArray< fcomplex > A) {
|
---|
437 | using (ILScope.Enter(A)) {
|
---|
438 | if (A.IsEmpty)
|
---|
439 | return new ILRetArray<fcomplex>(A.Size);
|
---|
440 | ILSize inDim = A.Size;
|
---|
441 | fcomplex[] arrA = A.GetArrayForRead();
|
---|
442 | fcomplex [] retArr;
|
---|
443 | int outLen = inDim.NumberOfElements;
|
---|
444 | bool inplace = true;
|
---|
445 |
|
---|
446 | if (!A.TryGetStorage4InplaceOp(out retArr)) {
|
---|
447 | retArr = ILMemoryPool.Pool.New<fcomplex>(outLen);
|
---|
448 | inplace = false;
|
---|
449 | }
|
---|
450 | int i = 0, workItemCount = Settings.s_maxNumberThreads, workItemLength, workerCount = 1;
|
---|
451 | if (Settings.s_maxNumberThreads > 1 && outLen / 2 > Settings.s_minParallelElement1Count) {
|
---|
452 | if (outLen / workItemCount > Settings.s_minParallelElement1Count) {
|
---|
453 | workItemLength = outLen / workItemCount;
|
---|
454 | //workItemLength = (int)((double)outLen / workItemCount * 1.05);
|
---|
455 | } else {
|
---|
456 | workItemLength = outLen / 2;
|
---|
457 | workItemCount = 2;
|
---|
458 | }
|
---|
459 | } else {
|
---|
460 | workItemLength = outLen;
|
---|
461 | workItemCount = 1;
|
---|
462 | }
|
---|
463 | ILDenseStorage<fcomplex> retStorage = new ILDenseStorage<fcomplex>(retArr, inDim);
|
---|
464 |
|
---|
465 | Action<object> worker = data => {
|
---|
466 | Tuple<int, int, IntPtr, IntPtr, bool> range = (Tuple<int, int, IntPtr, IntPtr, bool>)data;
|
---|
467 |
|
---|
468 | fcomplex* cp = ((fcomplex*)range.Item4 + range.Item1);
|
---|
469 | int len = range.Item2;
|
---|
470 | if (range.Item5) {
|
---|
471 | // inplace
|
---|
472 | while (len > 20) {
|
---|
473 | cp[0] = fcomplex.Asin(cp[0] ) /*dummy*/;
|
---|
474 | cp[1] = fcomplex.Asin(cp[1] ) /*dummy*/;
|
---|
475 | cp[2] = fcomplex.Asin(cp[2] ) /*dummy*/;
|
---|
476 | cp[3] = fcomplex.Asin(cp[3] ) /*dummy*/;
|
---|
477 | cp[4] = fcomplex.Asin(cp[4] ) /*dummy*/;
|
---|
478 | cp[5] = fcomplex.Asin(cp[5] ) /*dummy*/;
|
---|
479 | cp[6] = fcomplex.Asin(cp[6] ) /*dummy*/;
|
---|
480 | cp[7] = fcomplex.Asin(cp[7] ) /*dummy*/;
|
---|
481 | cp[8] = fcomplex.Asin(cp[8] ) /*dummy*/;
|
---|
482 | cp[9] = fcomplex.Asin(cp[9] ) /*dummy*/;
|
---|
483 | cp[10] = fcomplex.Asin(cp[10] ) /*dummy*/;
|
---|
484 | cp[11] = fcomplex.Asin(cp[11] ) /*dummy*/;
|
---|
485 | cp[12] = fcomplex.Asin(cp[12] ) /*dummy*/;
|
---|
486 | cp[13] = fcomplex.Asin(cp[13] ) /*dummy*/;
|
---|
487 | cp[14] = fcomplex.Asin(cp[14] ) /*dummy*/;
|
---|
488 | cp[15] = fcomplex.Asin(cp[15] ) /*dummy*/;
|
---|
489 | cp[16] = fcomplex.Asin(cp[16] ) /*dummy*/;
|
---|
490 | cp[17] = fcomplex.Asin(cp[17] ) /*dummy*/;
|
---|
491 | cp[18] = fcomplex.Asin(cp[18] ) /*dummy*/;
|
---|
492 | cp[19] = fcomplex.Asin(cp[19] ) /*dummy*/;
|
---|
493 | cp[20] = fcomplex.Asin(cp[20] ) /*dummy*/;
|
---|
494 | cp+=21; len -= 21;
|
---|
495 | }
|
---|
496 | while (len-- > 0) {
|
---|
497 | *cp = fcomplex.Asin(*cp ) /*dummy*/;
|
---|
498 | cp++;
|
---|
499 | }
|
---|
500 | } else {
|
---|
501 | fcomplex* ap = ((fcomplex*)range.Item3 + range.Item1);
|
---|
502 | while (len > 20) {
|
---|
503 | cp[0] = fcomplex.Asin(ap[0] ) /*dummy*/;
|
---|
504 | cp[1] = fcomplex.Asin(ap[1] ) /*dummy*/;
|
---|
505 | cp[2] = fcomplex.Asin(ap[2] ) /*dummy*/;
|
---|
506 | cp[3] = fcomplex.Asin(ap[3] ) /*dummy*/;
|
---|
507 | cp[4] = fcomplex.Asin(ap[4] ) /*dummy*/;
|
---|
508 | cp[5] = fcomplex.Asin(ap[5] ) /*dummy*/;
|
---|
509 | cp[6] = fcomplex.Asin(ap[6] ) /*dummy*/;
|
---|
510 | cp[7] = fcomplex.Asin(ap[7] ) /*dummy*/;
|
---|
511 | cp[8] = fcomplex.Asin(ap[8] ) /*dummy*/;
|
---|
512 | cp[9] = fcomplex.Asin(ap[9] ) /*dummy*/;
|
---|
513 | cp[10] = fcomplex.Asin(ap[10] ) /*dummy*/;
|
---|
514 | cp[11] = fcomplex.Asin(ap[11] ) /*dummy*/;
|
---|
515 | cp[12] = fcomplex.Asin(ap[12] ) /*dummy*/;
|
---|
516 | cp[13] = fcomplex.Asin(ap[13] ) /*dummy*/;
|
---|
517 | cp[14] = fcomplex.Asin(ap[14] ) /*dummy*/;
|
---|
518 | cp[15] = fcomplex.Asin(ap[15] ) /*dummy*/;
|
---|
519 | cp[16] = fcomplex.Asin(ap[16] ) /*dummy*/;
|
---|
520 | cp[17] = fcomplex.Asin(ap[17] ) /*dummy*/;
|
---|
521 | cp[18] = fcomplex.Asin(ap[18] ) /*dummy*/;
|
---|
522 | cp[19] = fcomplex.Asin(ap[19] ) /*dummy*/;
|
---|
523 | cp[20] = fcomplex.Asin(ap[20] ) /*dummy*/;
|
---|
524 | ap += 21;
|
---|
525 | cp += 21;
|
---|
526 | len -= 21;
|
---|
527 | }
|
---|
528 | while (len-- > 0) {
|
---|
529 | *cp = fcomplex.Asin(*ap ) /*dummy*/;
|
---|
530 | ap++;
|
---|
531 | cp++;
|
---|
532 | }
|
---|
533 | }
|
---|
534 | System.Threading.Interlocked.Decrement(ref workerCount);
|
---|
535 | };
|
---|
536 |
|
---|
537 | fixed ( fcomplex* arrAP = arrA)
|
---|
538 | fixed ( fcomplex* retArrP = retArr) {
|
---|
539 | for (; i < workItemCount - 1; i++) {
|
---|
540 | Tuple<int, int, IntPtr, IntPtr, bool> range
|
---|
541 | = new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
542 | (i * workItemLength, workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace);
|
---|
543 | System.Threading.Interlocked.Increment(ref workerCount);
|
---|
544 | ILThreadPool.QueueUserWorkItem(i,worker, range);
|
---|
545 | }
|
---|
546 | // the last (or may the only) chunk is done right here
|
---|
547 | worker(new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
548 | (i * workItemLength, outLen - i * workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace));
|
---|
549 |
|
---|
550 | ILThreadPool.Wait4Workers(ref workerCount);
|
---|
551 | }
|
---|
552 | return new ILRetArray<fcomplex>(retStorage);
|
---|
553 | }
|
---|
554 | }
|
---|
555 | /// <summary>Arcsine of array elements - real output</summary>
|
---|
556 | /// <param name="A">Input array</param>
|
---|
557 | /// <returns>Arcsine of array elements - real output</returns>
|
---|
558 | /// <remarks><para>If the input array is empty, an empty array will be returned.</para>
|
---|
559 | /// <para>The array returned will be a dense array.</para></remarks>
|
---|
560 | public unsafe static ILRetArray<float> asin (ILInArray< float > A) {
|
---|
561 | using (ILScope.Enter(A)) {
|
---|
562 | if (A.IsEmpty)
|
---|
563 | return new ILRetArray<float>(A.Size);
|
---|
564 | ILSize inDim = A.Size;
|
---|
565 | float[] arrA = A.GetArrayForRead();
|
---|
566 | float [] retArr;
|
---|
567 | int outLen = inDim.NumberOfElements;
|
---|
568 | bool inplace = true;
|
---|
569 |
|
---|
570 | if (!A.TryGetStorage4InplaceOp(out retArr)) {
|
---|
571 | retArr = ILMemoryPool.Pool.New<float>(outLen);
|
---|
572 | inplace = false;
|
---|
573 | }
|
---|
574 | int i = 0, workItemCount = Settings.s_maxNumberThreads, workItemLength, workerCount = 1;
|
---|
575 | if (Settings.s_maxNumberThreads > 1 && outLen / 2 > Settings.s_minParallelElement1Count) {
|
---|
576 | if (outLen / workItemCount > Settings.s_minParallelElement1Count) {
|
---|
577 | workItemLength = outLen / workItemCount;
|
---|
578 | //workItemLength = (int)((double)outLen / workItemCount * 1.05);
|
---|
579 | } else {
|
---|
580 | workItemLength = outLen / 2;
|
---|
581 | workItemCount = 2;
|
---|
582 | }
|
---|
583 | } else {
|
---|
584 | workItemLength = outLen;
|
---|
585 | workItemCount = 1;
|
---|
586 | }
|
---|
587 | ILDenseStorage<float> retStorage = new ILDenseStorage<float>(retArr, inDim);
|
---|
588 |
|
---|
589 | Action<object> worker = data => {
|
---|
590 | Tuple<int, int, IntPtr, IntPtr, bool> range = (Tuple<int, int, IntPtr, IntPtr, bool>)data;
|
---|
591 |
|
---|
592 | float* cp = ((float*)range.Item4 + range.Item1);
|
---|
593 | int len = range.Item2;
|
---|
594 | if (range.Item5) {
|
---|
595 | // inplace
|
---|
596 | while (len > 20) {
|
---|
597 | cp[0] = (float)Math.Asin(cp[0] ) /*dummy*/;
|
---|
598 | cp[1] = (float)Math.Asin(cp[1] ) /*dummy*/;
|
---|
599 | cp[2] = (float)Math.Asin(cp[2] ) /*dummy*/;
|
---|
600 | cp[3] = (float)Math.Asin(cp[3] ) /*dummy*/;
|
---|
601 | cp[4] = (float)Math.Asin(cp[4] ) /*dummy*/;
|
---|
602 | cp[5] = (float)Math.Asin(cp[5] ) /*dummy*/;
|
---|
603 | cp[6] = (float)Math.Asin(cp[6] ) /*dummy*/;
|
---|
604 | cp[7] = (float)Math.Asin(cp[7] ) /*dummy*/;
|
---|
605 | cp[8] = (float)Math.Asin(cp[8] ) /*dummy*/;
|
---|
606 | cp[9] = (float)Math.Asin(cp[9] ) /*dummy*/;
|
---|
607 | cp[10] = (float)Math.Asin(cp[10] ) /*dummy*/;
|
---|
608 | cp[11] = (float)Math.Asin(cp[11] ) /*dummy*/;
|
---|
609 | cp[12] = (float)Math.Asin(cp[12] ) /*dummy*/;
|
---|
610 | cp[13] = (float)Math.Asin(cp[13] ) /*dummy*/;
|
---|
611 | cp[14] = (float)Math.Asin(cp[14] ) /*dummy*/;
|
---|
612 | cp[15] = (float)Math.Asin(cp[15] ) /*dummy*/;
|
---|
613 | cp[16] = (float)Math.Asin(cp[16] ) /*dummy*/;
|
---|
614 | cp[17] = (float)Math.Asin(cp[17] ) /*dummy*/;
|
---|
615 | cp[18] = (float)Math.Asin(cp[18] ) /*dummy*/;
|
---|
616 | cp[19] = (float)Math.Asin(cp[19] ) /*dummy*/;
|
---|
617 | cp[20] = (float)Math.Asin(cp[20] ) /*dummy*/;
|
---|
618 | cp+=21; len -= 21;
|
---|
619 | }
|
---|
620 | while (len-- > 0) {
|
---|
621 | *cp = (float)Math.Asin(*cp ) /*dummy*/;
|
---|
622 | cp++;
|
---|
623 | }
|
---|
624 | } else {
|
---|
625 | float* ap = ((float*)range.Item3 + range.Item1);
|
---|
626 | while (len > 20) {
|
---|
627 | cp[0] = (float)Math.Asin(ap[0] ) /*dummy*/;
|
---|
628 | cp[1] = (float)Math.Asin(ap[1] ) /*dummy*/;
|
---|
629 | cp[2] = (float)Math.Asin(ap[2] ) /*dummy*/;
|
---|
630 | cp[3] = (float)Math.Asin(ap[3] ) /*dummy*/;
|
---|
631 | cp[4] = (float)Math.Asin(ap[4] ) /*dummy*/;
|
---|
632 | cp[5] = (float)Math.Asin(ap[5] ) /*dummy*/;
|
---|
633 | cp[6] = (float)Math.Asin(ap[6] ) /*dummy*/;
|
---|
634 | cp[7] = (float)Math.Asin(ap[7] ) /*dummy*/;
|
---|
635 | cp[8] = (float)Math.Asin(ap[8] ) /*dummy*/;
|
---|
636 | cp[9] = (float)Math.Asin(ap[9] ) /*dummy*/;
|
---|
637 | cp[10] = (float)Math.Asin(ap[10] ) /*dummy*/;
|
---|
638 | cp[11] = (float)Math.Asin(ap[11] ) /*dummy*/;
|
---|
639 | cp[12] = (float)Math.Asin(ap[12] ) /*dummy*/;
|
---|
640 | cp[13] = (float)Math.Asin(ap[13] ) /*dummy*/;
|
---|
641 | cp[14] = (float)Math.Asin(ap[14] ) /*dummy*/;
|
---|
642 | cp[15] = (float)Math.Asin(ap[15] ) /*dummy*/;
|
---|
643 | cp[16] = (float)Math.Asin(ap[16] ) /*dummy*/;
|
---|
644 | cp[17] = (float)Math.Asin(ap[17] ) /*dummy*/;
|
---|
645 | cp[18] = (float)Math.Asin(ap[18] ) /*dummy*/;
|
---|
646 | cp[19] = (float)Math.Asin(ap[19] ) /*dummy*/;
|
---|
647 | cp[20] = (float)Math.Asin(ap[20] ) /*dummy*/;
|
---|
648 | ap += 21;
|
---|
649 | cp += 21;
|
---|
650 | len -= 21;
|
---|
651 | }
|
---|
652 | while (len-- > 0) {
|
---|
653 | *cp = (float)Math.Asin(*ap ) /*dummy*/;
|
---|
654 | ap++;
|
---|
655 | cp++;
|
---|
656 | }
|
---|
657 | }
|
---|
658 | System.Threading.Interlocked.Decrement(ref workerCount);
|
---|
659 | };
|
---|
660 |
|
---|
661 | fixed ( float* arrAP = arrA)
|
---|
662 | fixed ( float* retArrP = retArr) {
|
---|
663 | for (; i < workItemCount - 1; i++) {
|
---|
664 | Tuple<int, int, IntPtr, IntPtr, bool> range
|
---|
665 | = new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
666 | (i * workItemLength, workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace);
|
---|
667 | System.Threading.Interlocked.Increment(ref workerCount);
|
---|
668 | ILThreadPool.QueueUserWorkItem(i,worker, range);
|
---|
669 | }
|
---|
670 | // the last (or may the only) chunk is done right here
|
---|
671 | worker(new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
672 | (i * workItemLength, outLen - i * workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace));
|
---|
673 |
|
---|
674 | ILThreadPool.Wait4Workers(ref workerCount);
|
---|
675 | }
|
---|
676 | return new ILRetArray<float>(retStorage);
|
---|
677 | }
|
---|
678 | }
|
---|
679 | /// <summary>Arcsine of array elements - real output</summary>
|
---|
680 | /// <param name="A">Input array</param>
|
---|
681 | /// <returns>Arcsine of array elements - real output</returns>
|
---|
682 | /// <remarks><para>If the input array is empty, an empty array will be returned.</para>
|
---|
683 | /// <para>The array returned will be a dense array.</para></remarks>
|
---|
684 | public unsafe static ILRetArray<double> asin (ILInArray< double > A) {
|
---|
685 | using (ILScope.Enter(A)) {
|
---|
686 | if (A.IsEmpty)
|
---|
687 | return new ILRetArray<double>(A.Size);
|
---|
688 | ILSize inDim = A.Size;
|
---|
689 | double[] arrA = A.GetArrayForRead();
|
---|
690 | double [] retArr;
|
---|
691 | int outLen = inDim.NumberOfElements;
|
---|
692 | bool inplace = true;
|
---|
693 |
|
---|
694 | if (!A.TryGetStorage4InplaceOp(out retArr)) {
|
---|
695 | retArr = ILMemoryPool.Pool.New<double>(outLen);
|
---|
696 | inplace = false;
|
---|
697 | }
|
---|
698 | int i = 0, workItemCount = Settings.s_maxNumberThreads, workItemLength, workerCount = 1;
|
---|
699 | if (Settings.s_maxNumberThreads > 1 && outLen / 2 > Settings.s_minParallelElement1Count) {
|
---|
700 | if (outLen / workItemCount > Settings.s_minParallelElement1Count) {
|
---|
701 | workItemLength = outLen / workItemCount;
|
---|
702 | //workItemLength = (int)((double)outLen / workItemCount * 1.05);
|
---|
703 | } else {
|
---|
704 | workItemLength = outLen / 2;
|
---|
705 | workItemCount = 2;
|
---|
706 | }
|
---|
707 | } else {
|
---|
708 | workItemLength = outLen;
|
---|
709 | workItemCount = 1;
|
---|
710 | }
|
---|
711 | ILDenseStorage<double> retStorage = new ILDenseStorage<double>(retArr, inDim);
|
---|
712 |
|
---|
713 | Action<object> worker = data => {
|
---|
714 | Tuple<int, int, IntPtr, IntPtr, bool> range = (Tuple<int, int, IntPtr, IntPtr, bool>)data;
|
---|
715 |
|
---|
716 | double* cp = ((double*)range.Item4 + range.Item1);
|
---|
717 | int len = range.Item2;
|
---|
718 | if (range.Item5) {
|
---|
719 | // inplace
|
---|
720 | while (len > 20) {
|
---|
721 | cp[0] = Math.Asin(cp[0] ) /*dummy*/;
|
---|
722 | cp[1] = Math.Asin(cp[1] ) /*dummy*/;
|
---|
723 | cp[2] = Math.Asin(cp[2] ) /*dummy*/;
|
---|
724 | cp[3] = Math.Asin(cp[3] ) /*dummy*/;
|
---|
725 | cp[4] = Math.Asin(cp[4] ) /*dummy*/;
|
---|
726 | cp[5] = Math.Asin(cp[5] ) /*dummy*/;
|
---|
727 | cp[6] = Math.Asin(cp[6] ) /*dummy*/;
|
---|
728 | cp[7] = Math.Asin(cp[7] ) /*dummy*/;
|
---|
729 | cp[8] = Math.Asin(cp[8] ) /*dummy*/;
|
---|
730 | cp[9] = Math.Asin(cp[9] ) /*dummy*/;
|
---|
731 | cp[10] = Math.Asin(cp[10] ) /*dummy*/;
|
---|
732 | cp[11] = Math.Asin(cp[11] ) /*dummy*/;
|
---|
733 | cp[12] = Math.Asin(cp[12] ) /*dummy*/;
|
---|
734 | cp[13] = Math.Asin(cp[13] ) /*dummy*/;
|
---|
735 | cp[14] = Math.Asin(cp[14] ) /*dummy*/;
|
---|
736 | cp[15] = Math.Asin(cp[15] ) /*dummy*/;
|
---|
737 | cp[16] = Math.Asin(cp[16] ) /*dummy*/;
|
---|
738 | cp[17] = Math.Asin(cp[17] ) /*dummy*/;
|
---|
739 | cp[18] = Math.Asin(cp[18] ) /*dummy*/;
|
---|
740 | cp[19] = Math.Asin(cp[19] ) /*dummy*/;
|
---|
741 | cp[20] = Math.Asin(cp[20] ) /*dummy*/;
|
---|
742 | cp+=21; len -= 21;
|
---|
743 | }
|
---|
744 | while (len-- > 0) {
|
---|
745 | *cp = Math.Asin(*cp ) /*dummy*/;
|
---|
746 | cp++;
|
---|
747 | }
|
---|
748 | } else {
|
---|
749 | double* ap = ((double*)range.Item3 + range.Item1);
|
---|
750 | while (len > 20) {
|
---|
751 | cp[0] = Math.Asin(ap[0] ) /*dummy*/;
|
---|
752 | cp[1] = Math.Asin(ap[1] ) /*dummy*/;
|
---|
753 | cp[2] = Math.Asin(ap[2] ) /*dummy*/;
|
---|
754 | cp[3] = Math.Asin(ap[3] ) /*dummy*/;
|
---|
755 | cp[4] = Math.Asin(ap[4] ) /*dummy*/;
|
---|
756 | cp[5] = Math.Asin(ap[5] ) /*dummy*/;
|
---|
757 | cp[6] = Math.Asin(ap[6] ) /*dummy*/;
|
---|
758 | cp[7] = Math.Asin(ap[7] ) /*dummy*/;
|
---|
759 | cp[8] = Math.Asin(ap[8] ) /*dummy*/;
|
---|
760 | cp[9] = Math.Asin(ap[9] ) /*dummy*/;
|
---|
761 | cp[10] = Math.Asin(ap[10] ) /*dummy*/;
|
---|
762 | cp[11] = Math.Asin(ap[11] ) /*dummy*/;
|
---|
763 | cp[12] = Math.Asin(ap[12] ) /*dummy*/;
|
---|
764 | cp[13] = Math.Asin(ap[13] ) /*dummy*/;
|
---|
765 | cp[14] = Math.Asin(ap[14] ) /*dummy*/;
|
---|
766 | cp[15] = Math.Asin(ap[15] ) /*dummy*/;
|
---|
767 | cp[16] = Math.Asin(ap[16] ) /*dummy*/;
|
---|
768 | cp[17] = Math.Asin(ap[17] ) /*dummy*/;
|
---|
769 | cp[18] = Math.Asin(ap[18] ) /*dummy*/;
|
---|
770 | cp[19] = Math.Asin(ap[19] ) /*dummy*/;
|
---|
771 | cp[20] = Math.Asin(ap[20] ) /*dummy*/;
|
---|
772 | ap += 21;
|
---|
773 | cp += 21;
|
---|
774 | len -= 21;
|
---|
775 | }
|
---|
776 | while (len-- > 0) {
|
---|
777 | *cp = Math.Asin(*ap ) /*dummy*/;
|
---|
778 | ap++;
|
---|
779 | cp++;
|
---|
780 | }
|
---|
781 | }
|
---|
782 | System.Threading.Interlocked.Decrement(ref workerCount);
|
---|
783 | };
|
---|
784 |
|
---|
785 | fixed ( double* arrAP = arrA)
|
---|
786 | fixed ( double* retArrP = retArr) {
|
---|
787 | for (; i < workItemCount - 1; i++) {
|
---|
788 | Tuple<int, int, IntPtr, IntPtr, bool> range
|
---|
789 | = new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
790 | (i * workItemLength, workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace);
|
---|
791 | System.Threading.Interlocked.Increment(ref workerCount);
|
---|
792 | ILThreadPool.QueueUserWorkItem(i,worker, range);
|
---|
793 | }
|
---|
794 | // the last (or may the only) chunk is done right here
|
---|
795 | worker(new Tuple<int, int, IntPtr, IntPtr, bool>
|
---|
796 | (i * workItemLength, outLen - i * workItemLength, (IntPtr)arrAP, (IntPtr)retArrP, inplace));
|
---|
797 |
|
---|
798 | ILThreadPool.Wait4Workers(ref workerCount);
|
---|
799 | }
|
---|
800 | return new ILRetArray<double>(retStorage);
|
---|
801 | }
|
---|
802 | }
|
---|
803 |
|
---|
804 | #endregion HYCALPER AUTO GENERATED CODE
|
---|
805 | }
|
---|
806 | } |
---|