paddlec 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,56 @@
1
+
2
+ PaddleC
3
+ =======
4
+
5
+ _PaddleC_ is a Ruby C extension attempting to provide objects and methods to rapidly set up real-time signal processing test benches in Ruby (because Ruby is so cool).
6
+
7
+ The Ruby code would look like _buffer administration_,
8
+ leaving the heavy processing to _C_ subroutines while keepking the user code concise and elegant,
9
+ without the need to recompile the whole thing each time the slightest change is made to the application.
10
+
11
+ `FloatBuffer` and `ComplexBuffer` wraps native arrays of single floats.
12
+ Computations are performed in _C_ on single floats, and depending on the host architecture it may be accelerated with AVX, SSE, FMA or NEON SIMD instructions.
13
+
14
+
15
+ How to install
16
+ --------------
17
+
18
+ First, install dependencies:
19
+ ```bash
20
+ sudo apt update
21
+ sudo apt install libpulse-dev
22
+ sudo apt install libfftw3-dev libfftw3-single3
23
+ ```
24
+
25
+ Clone this repository, build the gem and install it:
26
+ ```bash
27
+ git clone https://gitlab.com/theotime_bollengier/paddlec.git
28
+ cd paddlec
29
+ gem build paddlec.gemspec
30
+ gem install paddlec-XXX.gem # XXX is the version of the gem
31
+ ```
32
+
33
+ Generate the documentation:
34
+ ```bash
35
+ # Install yard if it is not already installed
36
+ gem install yard
37
+ # Use the helper script to generate the documentation
38
+ ./dodoc.sh
39
+ # Open the freshly generated documentation
40
+ firefox doc/index.html
41
+ ```
42
+
43
+
44
+ TODO
45
+ ----
46
+
47
+ * select, reject
48
+ * FFTw, FFTscope, Oscilloscope
49
+ * libswresample
50
+ * boolean buffers and [] +=
51
+ * pulseaudio sink / source
52
+ * rtlsdr source
53
+ * oscillators, PLLs, costas loops...
54
+ * doc rdoc, yard groups
55
+ * ...
56
+
@@ -0,0 +1,2486 @@
1
+ /* Copyright (C) 2019 Théotime Bollengier <theotime.bollengier@gmail.com>
2
+ *
3
+ * This file is part of PaddleC
4
+ *
5
+ * PaddleC is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * PaddleC is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with PaddleC. If not, see <https://www.gnu.org/licenses/>.
17
+ */
18
+
19
+ #include <stdlib.h>
20
+ #include <math.h>
21
+ #include "libpaddlec.h"
22
+
23
+
24
+ pdlc_buffer_t* pdlc_buffer_unaryminus(const pdlc_buffer_t *fbuf, pdlc_buffer_t *ofbuf)
25
+ {
26
+ size_t i;
27
+
28
+ if (!ofbuf)
29
+ ofbuf = pdlc_buffer_new(fbuf->length);
30
+ else
31
+ pdlc_buffer_resize(ofbuf, fbuf->length, 0);
32
+
33
+ for (i = 0; i < fbuf->length; i++)
34
+ ofbuf->data[i] = -fbuf->data[i];
35
+
36
+ return ofbuf;
37
+ }
38
+
39
+
40
+ pdlc_buffer_t* pdlc_buffer_unaryminus_inplace(pdlc_buffer_t *fbuf)
41
+ {
42
+ size_t i;
43
+
44
+ for (i = 0; i < fbuf->length; i++)
45
+ fbuf->data[i] = -fbuf->data[i];
46
+
47
+ return fbuf;
48
+ }
49
+
50
+
51
+ pdlc_complex_buffer_t* pdlc_complex_buffer_unaryminus(const pdlc_complex_buffer_t *cbuf, pdlc_complex_buffer_t *ocbuf)
52
+ {
53
+ size_t i;
54
+
55
+ if (!ocbuf)
56
+ ocbuf = pdlc_complex_buffer_new(cbuf->length);
57
+ else
58
+ pdlc_complex_buffer_resize(ocbuf, cbuf->length, 0);
59
+
60
+ for (i = 0; i < cbuf->length; i++) {
61
+ ocbuf->data[i].real = -cbuf->data[i].real;
62
+ ocbuf->data[i].imag = -cbuf->data[i].imag;
63
+ }
64
+
65
+ return ocbuf;
66
+ }
67
+
68
+
69
+ pdlc_complex_buffer_t* pdlc_complex_buffer_unaryminus_inplace(pdlc_complex_buffer_t *cbuf)
70
+ {
71
+ size_t i;
72
+
73
+ for (i = 0; i < cbuf->length; i++) {
74
+ cbuf->data[i].real = -cbuf->data[i].real;
75
+ cbuf->data[i].imag = -cbuf->data[i].imag;
76
+ }
77
+
78
+ return cbuf;
79
+ }
80
+
81
+
82
+ pdlc_buffer_t* pdlc_fb_fb_sub(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
83
+ {
84
+ size_t i;
85
+ size_t len = lhs->length;
86
+
87
+ if (len > rhs->length)
88
+ len = rhs->length;
89
+
90
+ if (!res)
91
+ res = pdlc_buffer_new(len);
92
+ else
93
+ pdlc_buffer_resize(res, len, 0);
94
+
95
+ for (i = 0; i < len; i++)
96
+ res->data[i] = lhs->data[i] - rhs->data[i];
97
+
98
+ return res;
99
+ }
100
+
101
+
102
+ pdlc_buffer_t* pdlc_fb_fb_sub_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
103
+ {
104
+ size_t i;
105
+ size_t len = lhs->length;
106
+
107
+ if (len > rhs->length)
108
+ len = rhs->length;
109
+
110
+ for (i = 0; i < len; i++)
111
+ lhs->data[i] = lhs->data[i] - rhs->data[i];
112
+
113
+ return lhs;
114
+ }
115
+
116
+
117
+ pdlc_buffer_t* pdlc_fb_fs_sub(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
118
+ {
119
+ size_t i;
120
+ const size_t len = lhs->length;
121
+
122
+ if (!res)
123
+ res = pdlc_buffer_new(len);
124
+ else
125
+ pdlc_buffer_resize(res, len, 0);
126
+
127
+ for (i = 0; i < len; i++)
128
+ res->data[i] = lhs->data[i] - rhs;
129
+
130
+ return res;
131
+ }
132
+
133
+
134
+ pdlc_buffer_t* pdlc_fb_fs_sub_inplace(pdlc_buffer_t *lhs, float rhs)
135
+ {
136
+ size_t i;
137
+ const size_t len = lhs->length;
138
+
139
+ for (i = 0; i < len; i++)
140
+ lhs->data[i] = lhs->data[i] - rhs;
141
+
142
+ return lhs;
143
+ }
144
+
145
+
146
+ pdlc_complex_buffer_t* pdlc_cb_cb_sub(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
147
+ {
148
+ size_t i;
149
+ size_t len = lhs->length;
150
+
151
+ if (len > rhs->length)
152
+ len = rhs->length;
153
+
154
+ if (!res)
155
+ res = pdlc_complex_buffer_new(len);
156
+ else
157
+ pdlc_complex_buffer_resize(res, len, 0);
158
+
159
+ for (i = 0; i < len; i++) {
160
+ res->data[i].real = lhs->data[i].real - rhs->data[i].real;
161
+ res->data[i].imag = lhs->data[i].imag - rhs->data[i].imag;
162
+ }
163
+
164
+ return res;
165
+ }
166
+
167
+
168
+ pdlc_complex_buffer_t* pdlc_cb_cb_sub_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
169
+ {
170
+ size_t i;
171
+ size_t len = lhs->length;
172
+
173
+ if (len > rhs->length)
174
+ len = rhs->length;
175
+
176
+ for (i = 0; i < len; i++) {
177
+ lhs->data[i].real = lhs->data[i].real - rhs->data[i].real;
178
+ lhs->data[i].imag = lhs->data[i].imag - rhs->data[i].imag;
179
+ }
180
+
181
+ return lhs;
182
+ }
183
+
184
+
185
+ pdlc_complex_buffer_t* pdlc_cb_cs_sub(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
186
+ {
187
+ size_t i;
188
+ const size_t len = lhs->length;
189
+
190
+ if (!res)
191
+ res = pdlc_complex_buffer_new(len);
192
+ else
193
+ pdlc_complex_buffer_resize(res, len, 0);
194
+
195
+ for (i = 0; i < len; i++) {
196
+ res->data[i].real = lhs->data[i].real - rhs.real;
197
+ res->data[i].imag = lhs->data[i].imag - rhs.imag;
198
+ }
199
+
200
+ return res;
201
+ }
202
+
203
+
204
+ pdlc_complex_buffer_t* pdlc_cb_cs_sub_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
205
+ {
206
+ size_t i;
207
+ const size_t len = lhs->length;
208
+
209
+ for (i = 0; i < len; i++) {
210
+ lhs->data[i].real = lhs->data[i].real - rhs.real;
211
+ lhs->data[i].imag = lhs->data[i].imag - rhs.imag;
212
+ }
213
+
214
+ return lhs;
215
+ }
216
+
217
+
218
+ pdlc_complex_buffer_t* pdlc_fb_cb_sub(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
219
+ {
220
+ size_t i;
221
+ size_t len = lhs->length;
222
+
223
+ if (len > rhs->length)
224
+ len = rhs->length;
225
+
226
+ if (!res)
227
+ res = pdlc_complex_buffer_new(len);
228
+ else
229
+ pdlc_complex_buffer_resize(res, len, 0);
230
+
231
+ for (i = 0; i < len; i++) {
232
+ res->data[i].real = lhs->data[i] - rhs->data[i].real;
233
+ res->data[i].imag = -rhs->data[i].imag;
234
+ }
235
+
236
+ return res;
237
+ }
238
+
239
+
240
+ pdlc_complex_buffer_t* pdlc_fb_cs_sub(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
241
+ {
242
+ size_t i;
243
+ const size_t len = lhs->length;
244
+
245
+ if (!res)
246
+ res = pdlc_complex_buffer_new(len);
247
+ else
248
+ pdlc_complex_buffer_resize(res, len, 0);
249
+
250
+ for (i = 0; i < len; i++) {
251
+ res->data[i].real = lhs->data[i] - rhs.real;
252
+ res->data[i].imag = -rhs.imag;
253
+ }
254
+
255
+ return res;
256
+ }
257
+
258
+
259
+ pdlc_complex_buffer_t* pdlc_cb_fb_sub(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
260
+ {
261
+ size_t i;
262
+ size_t len = lhs->length;
263
+
264
+ if (len > rhs->length)
265
+ len = rhs->length;
266
+
267
+ if (!res)
268
+ res = pdlc_complex_buffer_new(len);
269
+ else
270
+ pdlc_complex_buffer_resize(res, len, 0);
271
+
272
+ for (i = 0; i < len; i++) {
273
+ res->data[i].real = lhs->data[i].real - rhs->data[i];
274
+ res->data[i].imag = lhs->data[i].imag;
275
+ }
276
+
277
+ return res;
278
+ }
279
+
280
+
281
+ pdlc_complex_buffer_t* pdlc_cb_fb_sub_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
282
+ {
283
+ size_t i;
284
+ size_t len = lhs->length;
285
+
286
+ if (len > rhs->length)
287
+ len = rhs->length;
288
+
289
+ for (i = 0; i < len; i++) {
290
+ lhs->data[i].real = lhs->data[i].real - rhs->data[i];
291
+ lhs->data[i].imag = lhs->data[i].imag;
292
+ }
293
+
294
+ return lhs;
295
+ }
296
+
297
+
298
+ pdlc_complex_buffer_t* pdlc_cb_fs_sub(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
299
+ {
300
+ size_t i;
301
+ const size_t len = lhs->length;
302
+
303
+ if (!res)
304
+ res = pdlc_complex_buffer_new(len);
305
+ else
306
+ pdlc_complex_buffer_resize(res, len, 0);
307
+
308
+ for (i = 0; i < len; i++) {
309
+ res->data[i].real = lhs->data[i].real - rhs;
310
+ res->data[i].imag = lhs->data[i].imag;
311
+ }
312
+
313
+ return res;
314
+ }
315
+
316
+
317
+ pdlc_complex_buffer_t* pdlc_cb_fs_sub_inplace(pdlc_complex_buffer_t *lhs, float rhs)
318
+ {
319
+ size_t i;
320
+ const size_t len = lhs->length;
321
+
322
+ for (i = 0; i < len; i++) {
323
+ lhs->data[i].real = lhs->data[i].real - rhs;
324
+ lhs->data[i].imag = lhs->data[i].imag;
325
+ }
326
+
327
+ return lhs;
328
+ }
329
+
330
+
331
+ pdlc_buffer_t* pdlc_fb_fb_esub(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
332
+ {
333
+ size_t i;
334
+ size_t len = lhs->length;
335
+
336
+ if (len > rhs->length)
337
+ len = rhs->length;
338
+
339
+ if (!res)
340
+ res = pdlc_buffer_new(len);
341
+ else
342
+ pdlc_buffer_resize(res, len, 0);
343
+
344
+ for (i = 0; i < len; i++)
345
+ res->data[i] = lhs->data[i] - rhs->data[i];
346
+
347
+ return res;
348
+ }
349
+
350
+
351
+ pdlc_buffer_t* pdlc_fb_fb_esub_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
352
+ {
353
+ size_t i;
354
+ size_t len = lhs->length;
355
+
356
+ if (len > rhs->length)
357
+ len = rhs->length;
358
+
359
+ for (i = 0; i < len; i++)
360
+ lhs->data[i] = lhs->data[i] - rhs->data[i];
361
+
362
+ return lhs;
363
+ }
364
+
365
+
366
+ pdlc_buffer_t* pdlc_fb_fs_esub(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
367
+ {
368
+ size_t i;
369
+ const size_t len = lhs->length;
370
+
371
+ if (!res)
372
+ res = pdlc_buffer_new(len);
373
+ else
374
+ pdlc_buffer_resize(res, len, 0);
375
+
376
+ for (i = 0; i < len; i++)
377
+ res->data[i] = lhs->data[i] - rhs;
378
+
379
+ return res;
380
+ }
381
+
382
+
383
+ pdlc_buffer_t* pdlc_fb_fs_esub_inplace(pdlc_buffer_t *lhs, float rhs)
384
+ {
385
+ size_t i;
386
+ const size_t len = lhs->length;
387
+
388
+ for (i = 0; i < len; i++)
389
+ lhs->data[i] = lhs->data[i] - rhs;
390
+
391
+ return lhs;
392
+ }
393
+
394
+
395
+ pdlc_complex_buffer_t* pdlc_cb_cb_esub(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
396
+ {
397
+ size_t i;
398
+ size_t len = lhs->length;
399
+
400
+ if (len > rhs->length)
401
+ len = rhs->length;
402
+
403
+ if (!res)
404
+ res = pdlc_complex_buffer_new(len);
405
+ else
406
+ pdlc_complex_buffer_resize(res, len, 0);
407
+
408
+ for (i = 0; i < len; i++) {
409
+ res->data[i].real = lhs->data[i].real - rhs->data[i].real;
410
+ res->data[i].imag = lhs->data[i].imag - rhs->data[i].imag;
411
+ }
412
+
413
+ return res;
414
+ }
415
+
416
+
417
+ pdlc_complex_buffer_t* pdlc_cb_cb_esub_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
418
+ {
419
+ size_t i;
420
+ size_t len = lhs->length;
421
+
422
+ if (len > rhs->length)
423
+ len = rhs->length;
424
+
425
+ for (i = 0; i < len; i++) {
426
+ lhs->data[i].real = lhs->data[i].real - rhs->data[i].real;
427
+ lhs->data[i].imag = lhs->data[i].imag - rhs->data[i].imag;
428
+ }
429
+
430
+ return lhs;
431
+ }
432
+
433
+
434
+ pdlc_complex_buffer_t* pdlc_cb_cs_esub(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
435
+ {
436
+ size_t i;
437
+ const size_t len = lhs->length;
438
+
439
+ if (!res)
440
+ res = pdlc_complex_buffer_new(len);
441
+ else
442
+ pdlc_complex_buffer_resize(res, len, 0);
443
+
444
+ for (i = 0; i < len; i++) {
445
+ res->data[i].real = lhs->data[i].real - rhs.real;
446
+ res->data[i].imag = lhs->data[i].imag - rhs.imag;
447
+ }
448
+
449
+ return res;
450
+ }
451
+
452
+
453
+ pdlc_complex_buffer_t* pdlc_cb_cs_esub_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
454
+ {
455
+ size_t i;
456
+ const size_t len = lhs->length;
457
+
458
+ for (i = 0; i < len; i++) {
459
+ lhs->data[i].real = lhs->data[i].real - rhs.real;
460
+ lhs->data[i].imag = lhs->data[i].imag - rhs.imag;
461
+ }
462
+
463
+ return lhs;
464
+ }
465
+
466
+
467
+ pdlc_complex_buffer_t* pdlc_fb_cb_esub(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
468
+ {
469
+ size_t i;
470
+ size_t len = lhs->length;
471
+
472
+ if (len > rhs->length)
473
+ len = rhs->length;
474
+
475
+ if (!res)
476
+ res = pdlc_complex_buffer_new(len);
477
+ else
478
+ pdlc_complex_buffer_resize(res, len, 0);
479
+
480
+ for (i = 0; i < len; i++) {
481
+ res->data[i].real = lhs->data[i] - rhs->data[i].real;
482
+ res->data[i].imag = lhs->data[i] - rhs->data[i].imag;
483
+ }
484
+
485
+ return res;
486
+ }
487
+
488
+
489
+ pdlc_complex_buffer_t* pdlc_fb_cs_esub(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
490
+ {
491
+ size_t i;
492
+ const size_t len = lhs->length;
493
+
494
+ if (!res)
495
+ res = pdlc_complex_buffer_new(len);
496
+ else
497
+ pdlc_complex_buffer_resize(res, len, 0);
498
+
499
+ for (i = 0; i < len; i++) {
500
+ res->data[i].real = lhs->data[i] - rhs.real;
501
+ res->data[i].imag = lhs->data[i] - rhs.imag;
502
+ }
503
+
504
+ return res;
505
+ }
506
+
507
+
508
+ pdlc_complex_buffer_t* pdlc_cb_fb_esub(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
509
+ {
510
+ size_t i;
511
+ size_t len = lhs->length;
512
+
513
+ if (len > rhs->length)
514
+ len = rhs->length;
515
+
516
+ if (!res)
517
+ res = pdlc_complex_buffer_new(len);
518
+ else
519
+ pdlc_complex_buffer_resize(res, len, 0);
520
+
521
+ for (i = 0; i < len; i++) {
522
+ res->data[i].real = lhs->data[i].real - rhs->data[i];
523
+ res->data[i].imag = lhs->data[i].imag - rhs->data[i];
524
+ }
525
+
526
+ return res;
527
+ }
528
+
529
+
530
+ pdlc_complex_buffer_t* pdlc_cb_fb_esub_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
531
+ {
532
+ size_t i;
533
+ size_t len = lhs->length;
534
+
535
+ if (len > rhs->length)
536
+ len = rhs->length;
537
+
538
+ for (i = 0; i < len; i++) {
539
+ lhs->data[i].real = lhs->data[i].real - rhs->data[i];
540
+ lhs->data[i].imag = lhs->data[i].imag - rhs->data[i];
541
+ }
542
+
543
+ return lhs;
544
+ }
545
+
546
+
547
+ pdlc_complex_buffer_t* pdlc_cb_fs_esub(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
548
+ {
549
+ size_t i;
550
+ const size_t len = lhs->length;
551
+
552
+ if (!res)
553
+ res = pdlc_complex_buffer_new(len);
554
+ else
555
+ pdlc_complex_buffer_resize(res, len, 0);
556
+
557
+ for (i = 0; i < len; i++) {
558
+ res->data[i].real = lhs->data[i].real - rhs;
559
+ res->data[i].imag = lhs->data[i].imag - rhs;
560
+ }
561
+
562
+ return res;
563
+ }
564
+
565
+
566
+ pdlc_complex_buffer_t* pdlc_cb_fs_esub_inplace(pdlc_complex_buffer_t *lhs, float rhs)
567
+ {
568
+ size_t i;
569
+ const size_t len = lhs->length;
570
+
571
+ for (i = 0; i < len; i++) {
572
+ lhs->data[i].real = lhs->data[i].real - rhs;
573
+ lhs->data[i].imag = lhs->data[i].imag - rhs;
574
+ }
575
+
576
+ return lhs;
577
+ }
578
+
579
+
580
+ pdlc_buffer_t* pdlc_fb_fb_add(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
581
+ {
582
+ size_t i;
583
+ size_t len = lhs->length;
584
+
585
+ if (len > rhs->length)
586
+ len = rhs->length;
587
+
588
+ if (!res)
589
+ res = pdlc_buffer_new(len);
590
+ else
591
+ pdlc_buffer_resize(res, len, 0);
592
+
593
+ for (i = 0; i < len; i++)
594
+ res->data[i] = lhs->data[i] + rhs->data[i];
595
+
596
+ return res;
597
+ }
598
+
599
+
600
+ pdlc_buffer_t* pdlc_fb_fb_add_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
601
+ {
602
+ size_t i;
603
+ size_t len = lhs->length;
604
+
605
+ if (len > rhs->length)
606
+ len = rhs->length;
607
+
608
+ for (i = 0; i < len; i++)
609
+ lhs->data[i] = lhs->data[i] + rhs->data[i];
610
+
611
+ return lhs;
612
+ }
613
+
614
+
615
+ pdlc_buffer_t* pdlc_fb_fs_add(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
616
+ {
617
+ size_t i;
618
+ const size_t len = lhs->length;
619
+
620
+ if (!res)
621
+ res = pdlc_buffer_new(len);
622
+ else
623
+ pdlc_buffer_resize(res, len, 0);
624
+
625
+ for (i = 0; i < len; i++)
626
+ res->data[i] = lhs->data[i] + rhs;
627
+
628
+ return res;
629
+ }
630
+
631
+
632
+ pdlc_buffer_t* pdlc_fb_fs_add_inplace(pdlc_buffer_t *lhs, float rhs)
633
+ {
634
+ size_t i;
635
+ const size_t len = lhs->length;
636
+
637
+ for (i = 0; i < len; i++)
638
+ lhs->data[i] = lhs->data[i] + rhs;
639
+
640
+ return lhs;
641
+ }
642
+
643
+
644
+ pdlc_complex_buffer_t* pdlc_cb_cb_add(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
645
+ {
646
+ size_t i;
647
+ size_t len = lhs->length;
648
+
649
+ if (len > rhs->length)
650
+ len = rhs->length;
651
+
652
+ if (!res)
653
+ res = pdlc_complex_buffer_new(len);
654
+ else
655
+ pdlc_complex_buffer_resize(res, len, 0);
656
+
657
+ for (i = 0; i < len; i++) {
658
+ res->data[i].real = lhs->data[i].real + rhs->data[i].real;
659
+ res->data[i].imag = lhs->data[i].imag + rhs->data[i].imag;
660
+ }
661
+
662
+ return res;
663
+ }
664
+
665
+
666
+ pdlc_complex_buffer_t* pdlc_cb_cb_add_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
667
+ {
668
+ size_t i;
669
+ size_t len = lhs->length;
670
+
671
+ if (len > rhs->length)
672
+ len = rhs->length;
673
+
674
+ for (i = 0; i < len; i++) {
675
+ lhs->data[i].real = lhs->data[i].real + rhs->data[i].real;
676
+ lhs->data[i].imag = lhs->data[i].imag + rhs->data[i].imag;
677
+ }
678
+
679
+ return lhs;
680
+ }
681
+
682
+
683
+ pdlc_complex_buffer_t* pdlc_cb_cs_add(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
684
+ {
685
+ size_t i;
686
+ const size_t len = lhs->length;
687
+
688
+ if (!res)
689
+ res = pdlc_complex_buffer_new(len);
690
+ else
691
+ pdlc_complex_buffer_resize(res, len, 0);
692
+
693
+ for (i = 0; i < len; i++) {
694
+ res->data[i].real = lhs->data[i].real + rhs.real;
695
+ res->data[i].imag = lhs->data[i].imag + rhs.imag;
696
+ }
697
+
698
+ return res;
699
+ }
700
+
701
+
702
+ pdlc_complex_buffer_t* pdlc_cb_cs_add_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
703
+ {
704
+ size_t i;
705
+ const size_t len = lhs->length;
706
+
707
+ for (i = 0; i < len; i++) {
708
+ lhs->data[i].real = lhs->data[i].real + rhs.real;
709
+ lhs->data[i].imag = lhs->data[i].imag + rhs.imag;
710
+ }
711
+
712
+ return lhs;
713
+ }
714
+
715
+
716
+ pdlc_complex_buffer_t* pdlc_fb_cb_add(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
717
+ {
718
+ size_t i;
719
+ size_t len = lhs->length;
720
+
721
+ if (len > rhs->length)
722
+ len = rhs->length;
723
+
724
+ if (!res)
725
+ res = pdlc_complex_buffer_new(len);
726
+ else
727
+ pdlc_complex_buffer_resize(res, len, 0);
728
+
729
+ for (i = 0; i < len; i++) {
730
+ res->data[i].real = lhs->data[i] + rhs->data[i].real;
731
+ res->data[i].imag = rhs->data[i].imag;
732
+ }
733
+
734
+ return res;
735
+ }
736
+
737
+
738
+ pdlc_complex_buffer_t* pdlc_fb_cs_add(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
739
+ {
740
+ size_t i;
741
+ const size_t len = lhs->length;
742
+
743
+ if (!res)
744
+ res = pdlc_complex_buffer_new(len);
745
+ else
746
+ pdlc_complex_buffer_resize(res, len, 0);
747
+
748
+ for (i = 0; i < len; i++) {
749
+ res->data[i].real = lhs->data[i] + rhs.real;
750
+ res->data[i].imag = rhs.imag;
751
+ }
752
+
753
+ return res;
754
+ }
755
+
756
+
757
+ pdlc_complex_buffer_t* pdlc_cb_fb_add(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
758
+ {
759
+ size_t i;
760
+ size_t len = lhs->length;
761
+
762
+ if (len > rhs->length)
763
+ len = rhs->length;
764
+
765
+ if (!res)
766
+ res = pdlc_complex_buffer_new(len);
767
+ else
768
+ pdlc_complex_buffer_resize(res, len, 0);
769
+
770
+ for (i = 0; i < len; i++) {
771
+ res->data[i].real = lhs->data[i].real + rhs->data[i];
772
+ res->data[i].imag = lhs->data[i].imag;
773
+ }
774
+
775
+ return res;
776
+ }
777
+
778
+
779
+ pdlc_complex_buffer_t* pdlc_cb_fb_add_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
780
+ {
781
+ size_t i;
782
+ size_t len = lhs->length;
783
+
784
+ if (len > rhs->length)
785
+ len = rhs->length;
786
+
787
+ for (i = 0; i < len; i++) {
788
+ lhs->data[i].real = lhs->data[i].real + rhs->data[i];
789
+ lhs->data[i].imag = lhs->data[i].imag;
790
+ }
791
+
792
+ return lhs;
793
+ }
794
+
795
+
796
+ pdlc_complex_buffer_t* pdlc_cb_fs_add(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
797
+ {
798
+ size_t i;
799
+ const size_t len = lhs->length;
800
+
801
+ if (!res)
802
+ res = pdlc_complex_buffer_new(len);
803
+ else
804
+ pdlc_complex_buffer_resize(res, len, 0);
805
+
806
+ for (i = 0; i < len; i++) {
807
+ res->data[i].real = lhs->data[i].real + rhs;
808
+ res->data[i].imag = lhs->data[i].imag;
809
+ }
810
+
811
+ return res;
812
+ }
813
+
814
+
815
+ pdlc_complex_buffer_t* pdlc_cb_fs_add_inplace(pdlc_complex_buffer_t *lhs, float rhs)
816
+ {
817
+ size_t i;
818
+ const size_t len = lhs->length;
819
+
820
+ for (i = 0; i < len; i++) {
821
+ lhs->data[i].real = lhs->data[i].real + rhs;
822
+ lhs->data[i].imag = lhs->data[i].imag;
823
+ }
824
+
825
+ return lhs;
826
+ }
827
+
828
+
829
+ pdlc_buffer_t* pdlc_fb_fb_eadd(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
830
+ {
831
+ size_t i;
832
+ size_t len = lhs->length;
833
+
834
+ if (len > rhs->length)
835
+ len = rhs->length;
836
+
837
+ if (!res)
838
+ res = pdlc_buffer_new(len);
839
+ else
840
+ pdlc_buffer_resize(res, len, 0);
841
+
842
+ for (i = 0; i < len; i++)
843
+ res->data[i] = lhs->data[i] + rhs->data[i];
844
+
845
+ return res;
846
+ }
847
+
848
+
849
+ pdlc_buffer_t* pdlc_fb_fb_eadd_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
850
+ {
851
+ size_t i;
852
+ size_t len = lhs->length;
853
+
854
+ if (len > rhs->length)
855
+ len = rhs->length;
856
+
857
+ for (i = 0; i < len; i++)
858
+ lhs->data[i] = lhs->data[i] + rhs->data[i];
859
+
860
+ return lhs;
861
+ }
862
+
863
+
864
+ pdlc_buffer_t* pdlc_fb_fs_eadd(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
865
+ {
866
+ size_t i;
867
+ const size_t len = lhs->length;
868
+
869
+ if (!res)
870
+ res = pdlc_buffer_new(len);
871
+ else
872
+ pdlc_buffer_resize(res, len, 0);
873
+
874
+ for (i = 0; i < len; i++)
875
+ res->data[i] = lhs->data[i] + rhs;
876
+
877
+ return res;
878
+ }
879
+
880
+
881
+ pdlc_buffer_t* pdlc_fb_fs_eadd_inplace(pdlc_buffer_t *lhs, float rhs)
882
+ {
883
+ size_t i;
884
+ const size_t len = lhs->length;
885
+
886
+ for (i = 0; i < len; i++)
887
+ lhs->data[i] = lhs->data[i] + rhs;
888
+
889
+ return lhs;
890
+ }
891
+
892
+
893
+ pdlc_complex_buffer_t* pdlc_cb_cb_eadd(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
894
+ {
895
+ size_t i;
896
+ size_t len = lhs->length;
897
+
898
+ if (len > rhs->length)
899
+ len = rhs->length;
900
+
901
+ if (!res)
902
+ res = pdlc_complex_buffer_new(len);
903
+ else
904
+ pdlc_complex_buffer_resize(res, len, 0);
905
+
906
+ for (i = 0; i < len; i++) {
907
+ res->data[i].real = lhs->data[i].real + rhs->data[i].real;
908
+ res->data[i].imag = lhs->data[i].imag + rhs->data[i].imag;
909
+ }
910
+
911
+ return res;
912
+ }
913
+
914
+
915
+ pdlc_complex_buffer_t* pdlc_cb_cb_eadd_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
916
+ {
917
+ size_t i;
918
+ size_t len = lhs->length;
919
+
920
+ if (len > rhs->length)
921
+ len = rhs->length;
922
+
923
+ for (i = 0; i < len; i++) {
924
+ lhs->data[i].real = lhs->data[i].real + rhs->data[i].real;
925
+ lhs->data[i].imag = lhs->data[i].imag + rhs->data[i].imag;
926
+ }
927
+
928
+ return lhs;
929
+ }
930
+
931
+
932
+ pdlc_complex_buffer_t* pdlc_cb_cs_eadd(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
933
+ {
934
+ size_t i;
935
+ const size_t len = lhs->length;
936
+
937
+ if (!res)
938
+ res = pdlc_complex_buffer_new(len);
939
+ else
940
+ pdlc_complex_buffer_resize(res, len, 0);
941
+
942
+ for (i = 0; i < len; i++) {
943
+ res->data[i].real = lhs->data[i].real + rhs.real;
944
+ res->data[i].imag = lhs->data[i].imag + rhs.imag;
945
+ }
946
+
947
+ return res;
948
+ }
949
+
950
+
951
+ pdlc_complex_buffer_t* pdlc_cb_cs_eadd_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
952
+ {
953
+ size_t i;
954
+ const size_t len = lhs->length;
955
+
956
+ for (i = 0; i < len; i++) {
957
+ lhs->data[i].real = lhs->data[i].real + rhs.real;
958
+ lhs->data[i].imag = lhs->data[i].imag + rhs.imag;
959
+ }
960
+
961
+ return lhs;
962
+ }
963
+
964
+
965
+ pdlc_complex_buffer_t* pdlc_fb_cb_eadd(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
966
+ {
967
+ size_t i;
968
+ size_t len = lhs->length;
969
+
970
+ if (len > rhs->length)
971
+ len = rhs->length;
972
+
973
+ if (!res)
974
+ res = pdlc_complex_buffer_new(len);
975
+ else
976
+ pdlc_complex_buffer_resize(res, len, 0);
977
+
978
+ for (i = 0; i < len; i++) {
979
+ res->data[i].real = lhs->data[i] + rhs->data[i].real;
980
+ res->data[i].imag = lhs->data[i] + rhs->data[i].imag;
981
+ }
982
+
983
+ return res;
984
+ }
985
+
986
+
987
+ pdlc_complex_buffer_t* pdlc_fb_cs_eadd(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
988
+ {
989
+ size_t i;
990
+ const size_t len = lhs->length;
991
+
992
+ if (!res)
993
+ res = pdlc_complex_buffer_new(len);
994
+ else
995
+ pdlc_complex_buffer_resize(res, len, 0);
996
+
997
+ for (i = 0; i < len; i++) {
998
+ res->data[i].real = lhs->data[i] + rhs.real;
999
+ res->data[i].imag = lhs->data[i] + rhs.imag;
1000
+ }
1001
+
1002
+ return res;
1003
+ }
1004
+
1005
+
1006
+ pdlc_complex_buffer_t* pdlc_cb_fb_eadd(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
1007
+ {
1008
+ size_t i;
1009
+ size_t len = lhs->length;
1010
+
1011
+ if (len > rhs->length)
1012
+ len = rhs->length;
1013
+
1014
+ if (!res)
1015
+ res = pdlc_complex_buffer_new(len);
1016
+ else
1017
+ pdlc_complex_buffer_resize(res, len, 0);
1018
+
1019
+ for (i = 0; i < len; i++) {
1020
+ res->data[i].real = lhs->data[i].real + rhs->data[i];
1021
+ res->data[i].imag = lhs->data[i].imag + rhs->data[i];
1022
+ }
1023
+
1024
+ return res;
1025
+ }
1026
+
1027
+
1028
+ pdlc_complex_buffer_t* pdlc_cb_fb_eadd_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
1029
+ {
1030
+ size_t i;
1031
+ size_t len = lhs->length;
1032
+
1033
+ if (len > rhs->length)
1034
+ len = rhs->length;
1035
+
1036
+ for (i = 0; i < len; i++) {
1037
+ lhs->data[i].real = lhs->data[i].real + rhs->data[i];
1038
+ lhs->data[i].imag = lhs->data[i].imag + rhs->data[i];
1039
+ }
1040
+
1041
+ return lhs;
1042
+ }
1043
+
1044
+
1045
+ pdlc_complex_buffer_t* pdlc_cb_fs_eadd(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
1046
+ {
1047
+ size_t i;
1048
+ const size_t len = lhs->length;
1049
+
1050
+ if (!res)
1051
+ res = pdlc_complex_buffer_new(len);
1052
+ else
1053
+ pdlc_complex_buffer_resize(res, len, 0);
1054
+
1055
+ for (i = 0; i < len; i++) {
1056
+ res->data[i].real = lhs->data[i].real + rhs;
1057
+ res->data[i].imag = lhs->data[i].imag + rhs;
1058
+ }
1059
+
1060
+ return res;
1061
+ }
1062
+
1063
+
1064
+ pdlc_complex_buffer_t* pdlc_cb_fs_eadd_inplace(pdlc_complex_buffer_t *lhs, float rhs)
1065
+ {
1066
+ size_t i;
1067
+ const size_t len = lhs->length;
1068
+
1069
+ for (i = 0; i < len; i++) {
1070
+ lhs->data[i].real = lhs->data[i].real + rhs;
1071
+ lhs->data[i].imag = lhs->data[i].imag + rhs;
1072
+ }
1073
+
1074
+ return lhs;
1075
+ }
1076
+
1077
+
1078
+ pdlc_buffer_t* pdlc_fb_fb_mult(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
1079
+ {
1080
+ size_t i;
1081
+ size_t len = lhs->length;
1082
+
1083
+ if (len > rhs->length)
1084
+ len = rhs->length;
1085
+
1086
+ if (!res)
1087
+ res = pdlc_buffer_new(len);
1088
+ else
1089
+ pdlc_buffer_resize(res, len, 0);
1090
+
1091
+ for (i = 0; i < len; i++)
1092
+ res->data[i] = lhs->data[i] * rhs->data[i];
1093
+
1094
+ return res;
1095
+ }
1096
+
1097
+
1098
+ pdlc_buffer_t* pdlc_fb_fb_mult_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
1099
+ {
1100
+ size_t i;
1101
+ size_t len = lhs->length;
1102
+
1103
+ if (len > rhs->length)
1104
+ len = rhs->length;
1105
+
1106
+ for (i = 0; i < len; i++)
1107
+ lhs->data[i] = lhs->data[i] * rhs->data[i];
1108
+
1109
+ return lhs;
1110
+ }
1111
+
1112
+
1113
+ pdlc_buffer_t* pdlc_fb_fs_mult(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
1114
+ {
1115
+ size_t i;
1116
+ const size_t len = lhs->length;
1117
+
1118
+ if (!res)
1119
+ res = pdlc_buffer_new(len);
1120
+ else
1121
+ pdlc_buffer_resize(res, len, 0);
1122
+
1123
+ for (i = 0; i < len; i++)
1124
+ res->data[i] = lhs->data[i] * rhs;
1125
+
1126
+ return res;
1127
+ }
1128
+
1129
+
1130
+ pdlc_buffer_t* pdlc_fb_fs_mult_inplace(pdlc_buffer_t *lhs, float rhs)
1131
+ {
1132
+ size_t i;
1133
+ const size_t len = lhs->length;
1134
+
1135
+ for (i = 0; i < len; i++)
1136
+ lhs->data[i] = lhs->data[i] * rhs;
1137
+
1138
+ return lhs;
1139
+ }
1140
+
1141
+
1142
+ pdlc_complex_buffer_t* pdlc_cb_cb_mult(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1143
+ {
1144
+ size_t i;
1145
+ pdlc_complex_t tmp;
1146
+ size_t len = lhs->length;
1147
+
1148
+ if (len > rhs->length)
1149
+ len = rhs->length;
1150
+
1151
+ if (!res)
1152
+ res = pdlc_complex_buffer_new(len);
1153
+ else
1154
+ pdlc_complex_buffer_resize(res, len, 0);
1155
+
1156
+ for (i = 0; i < len; i++) {
1157
+ tmp.real = lhs->data[i].real * rhs->data[i].real - lhs->data[i].imag * rhs->data[i].imag;
1158
+ tmp.imag = lhs->data[i].real * rhs->data[i].imag + lhs->data[i].imag * rhs->data[i].real;
1159
+ res->data[i] = tmp;
1160
+ }
1161
+
1162
+ return res;
1163
+ }
1164
+
1165
+
1166
+ pdlc_complex_buffer_t* pdlc_cb_cb_mult_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
1167
+ {
1168
+ size_t i;
1169
+ pdlc_complex_t tmp;
1170
+ size_t len = lhs->length;
1171
+
1172
+ if (len > rhs->length)
1173
+ len = rhs->length;
1174
+
1175
+ for (i = 0; i < len; i++) {
1176
+ tmp.real = lhs->data[i].real * rhs->data[i].real - lhs->data[i].imag * rhs->data[i].imag;
1177
+ tmp.imag = lhs->data[i].real * rhs->data[i].imag + lhs->data[i].imag * rhs->data[i].real;
1178
+ lhs->data[i] = tmp;
1179
+ }
1180
+
1181
+ return lhs;
1182
+ }
1183
+
1184
+
1185
+ pdlc_complex_buffer_t* pdlc_cb_cs_mult(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1186
+ {
1187
+ size_t i;
1188
+ pdlc_complex_t tmp;
1189
+ const size_t len = lhs->length;
1190
+
1191
+ if (!res)
1192
+ res = pdlc_complex_buffer_new(len);
1193
+ else
1194
+ pdlc_complex_buffer_resize(res, len, 0);
1195
+
1196
+ for (i = 0; i < len; i++) {
1197
+ tmp.real = lhs->data[i].real * rhs.real - lhs->data[i].imag * rhs.imag;
1198
+ tmp.imag = lhs->data[i].real * rhs.imag + lhs->data[i].imag * rhs.real;
1199
+ res->data[i] = tmp;
1200
+ }
1201
+
1202
+ return res;
1203
+ }
1204
+
1205
+
1206
+ pdlc_complex_buffer_t* pdlc_cb_cs_mult_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
1207
+ {
1208
+ size_t i;
1209
+ pdlc_complex_t tmp;
1210
+ const size_t len = lhs->length;
1211
+
1212
+ for (i = 0; i < len; i++) {
1213
+ tmp.real = lhs->data[i].real * rhs.real - lhs->data[i].imag * rhs.imag;
1214
+ tmp.imag = lhs->data[i].real * rhs.imag + lhs->data[i].imag * rhs.real;
1215
+ lhs->data[i] = tmp;
1216
+ }
1217
+
1218
+ return lhs;
1219
+ }
1220
+
1221
+
1222
+ pdlc_complex_buffer_t* pdlc_fb_cb_mult(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1223
+ {
1224
+ size_t i;
1225
+ size_t len = lhs->length;
1226
+
1227
+ if (len > rhs->length)
1228
+ len = rhs->length;
1229
+
1230
+ if (!res)
1231
+ res = pdlc_complex_buffer_new(len);
1232
+ else
1233
+ pdlc_complex_buffer_resize(res, len, 0);
1234
+
1235
+ for (i = 0; i < len; i++) {
1236
+ res->data[i].real = lhs->data[i] * rhs->data[i].real;
1237
+ res->data[i].imag = lhs->data[i] * rhs->data[i].imag;
1238
+ }
1239
+
1240
+ return res;
1241
+ }
1242
+
1243
+
1244
+ pdlc_complex_buffer_t* pdlc_fb_cs_mult(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1245
+ {
1246
+ size_t i;
1247
+ const size_t len = lhs->length;
1248
+
1249
+ if (!res)
1250
+ res = pdlc_complex_buffer_new(len);
1251
+ else
1252
+ pdlc_complex_buffer_resize(res, len, 0);
1253
+
1254
+ for (i = 0; i < len; i++) {
1255
+ res->data[i].real = lhs->data[i] * rhs.real;
1256
+ res->data[i].imag = lhs->data[i] * rhs.imag;
1257
+ }
1258
+
1259
+ return res;
1260
+ }
1261
+
1262
+
1263
+ pdlc_complex_buffer_t* pdlc_cb_fb_mult(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
1264
+ {
1265
+ size_t i;
1266
+ size_t len = lhs->length;
1267
+
1268
+ if (len > rhs->length)
1269
+ len = rhs->length;
1270
+
1271
+ if (!res)
1272
+ res = pdlc_complex_buffer_new(len);
1273
+ else
1274
+ pdlc_complex_buffer_resize(res, len, 0);
1275
+
1276
+ for (i = 0; i < len; i++) {
1277
+ res->data[i].real = lhs->data[i].real * rhs->data[i];
1278
+ res->data[i].imag = lhs->data[i].imag * rhs->data[i];
1279
+ }
1280
+
1281
+ return res;
1282
+ }
1283
+
1284
+
1285
+ pdlc_complex_buffer_t* pdlc_cb_fb_mult_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
1286
+ {
1287
+ size_t i;
1288
+ size_t len = lhs->length;
1289
+
1290
+ if (len > rhs->length)
1291
+ len = rhs->length;
1292
+
1293
+ for (i = 0; i < len; i++) {
1294
+ lhs->data[i].real = lhs->data[i].real * rhs->data[i];
1295
+ lhs->data[i].imag = lhs->data[i].imag * rhs->data[i];
1296
+ }
1297
+
1298
+ return lhs;
1299
+ }
1300
+
1301
+
1302
+ pdlc_complex_buffer_t* pdlc_cb_fs_mult(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
1303
+ {
1304
+ size_t i;
1305
+ const size_t len = lhs->length;
1306
+
1307
+ if (!res)
1308
+ res = pdlc_complex_buffer_new(len);
1309
+ else
1310
+ pdlc_complex_buffer_resize(res, len, 0);
1311
+
1312
+ for (i = 0; i < len; i++) {
1313
+ res->data[i].real = lhs->data[i].real * rhs;
1314
+ res->data[i].imag = lhs->data[i].imag * rhs;
1315
+ }
1316
+
1317
+ return res;
1318
+ }
1319
+
1320
+
1321
+ pdlc_complex_buffer_t* pdlc_cb_fs_mult_inplace(pdlc_complex_buffer_t *lhs, float rhs)
1322
+ {
1323
+ size_t i;
1324
+ const size_t len = lhs->length;
1325
+
1326
+ for (i = 0; i < len; i++) {
1327
+ lhs->data[i].real = lhs->data[i].real * rhs;
1328
+ lhs->data[i].imag = lhs->data[i].imag * rhs;
1329
+ }
1330
+
1331
+ return lhs;
1332
+ }
1333
+
1334
+
1335
+ pdlc_buffer_t* pdlc_fb_fb_emult(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
1336
+ {
1337
+ size_t i;
1338
+ size_t len = lhs->length;
1339
+
1340
+ if (len > rhs->length)
1341
+ len = rhs->length;
1342
+
1343
+ if (!res)
1344
+ res = pdlc_buffer_new(len);
1345
+ else
1346
+ pdlc_buffer_resize(res, len, 0);
1347
+
1348
+ for (i = 0; i < len; i++)
1349
+ res->data[i] = lhs->data[i] * rhs->data[i];
1350
+
1351
+ return res;
1352
+ }
1353
+
1354
+
1355
+ pdlc_buffer_t* pdlc_fb_fb_emult_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
1356
+ {
1357
+ size_t i;
1358
+ size_t len = lhs->length;
1359
+
1360
+ if (len > rhs->length)
1361
+ len = rhs->length;
1362
+
1363
+ for (i = 0; i < len; i++)
1364
+ lhs->data[i] = lhs->data[i] * rhs->data[i];
1365
+
1366
+ return lhs;
1367
+ }
1368
+
1369
+
1370
+ pdlc_buffer_t* pdlc_fb_fs_emult(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
1371
+ {
1372
+ size_t i;
1373
+ const size_t len = lhs->length;
1374
+
1375
+ if (!res)
1376
+ res = pdlc_buffer_new(len);
1377
+ else
1378
+ pdlc_buffer_resize(res, len, 0);
1379
+
1380
+ for (i = 0; i < len; i++)
1381
+ res->data[i] = lhs->data[i] * rhs;
1382
+
1383
+ return res;
1384
+ }
1385
+
1386
+
1387
+ pdlc_buffer_t* pdlc_fb_fs_emult_inplace(pdlc_buffer_t *lhs, float rhs)
1388
+ {
1389
+ size_t i;
1390
+ const size_t len = lhs->length;
1391
+
1392
+ for (i = 0; i < len; i++)
1393
+ lhs->data[i] = lhs->data[i] * rhs;
1394
+
1395
+ return lhs;
1396
+ }
1397
+
1398
+
1399
+ pdlc_complex_buffer_t* pdlc_cb_cb_emult(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1400
+ {
1401
+ size_t i;
1402
+ size_t len = lhs->length;
1403
+
1404
+ if (len > rhs->length)
1405
+ len = rhs->length;
1406
+
1407
+ if (!res)
1408
+ res = pdlc_complex_buffer_new(len);
1409
+ else
1410
+ pdlc_complex_buffer_resize(res, len, 0);
1411
+
1412
+ for (i = 0; i < len; i++) {
1413
+ res->data[i].real = lhs->data[i].real * rhs->data[i].real;
1414
+ res->data[i].imag = lhs->data[i].imag * rhs->data[i].imag;
1415
+ }
1416
+
1417
+ return res;
1418
+ }
1419
+
1420
+
1421
+ pdlc_complex_buffer_t* pdlc_cb_cb_emult_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
1422
+ {
1423
+ size_t i;
1424
+ size_t len = lhs->length;
1425
+
1426
+ if (len > rhs->length)
1427
+ len = rhs->length;
1428
+
1429
+ for (i = 0; i < len; i++) {
1430
+ lhs->data[i].real = lhs->data[i].real * rhs->data[i].real;
1431
+ lhs->data[i].imag = lhs->data[i].imag * rhs->data[i].imag;
1432
+ }
1433
+
1434
+ return lhs;
1435
+ }
1436
+
1437
+
1438
+ pdlc_complex_buffer_t* pdlc_cb_cs_emult(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1439
+ {
1440
+ size_t i;
1441
+ const size_t len = lhs->length;
1442
+
1443
+ if (!res)
1444
+ res = pdlc_complex_buffer_new(len);
1445
+ else
1446
+ pdlc_complex_buffer_resize(res, len, 0);
1447
+
1448
+ for (i = 0; i < len; i++) {
1449
+ res->data[i].real = lhs->data[i].real * rhs.real;
1450
+ res->data[i].imag = lhs->data[i].imag * rhs.imag;
1451
+ }
1452
+
1453
+ return res;
1454
+ }
1455
+
1456
+
1457
+ pdlc_complex_buffer_t* pdlc_cb_cs_emult_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
1458
+ {
1459
+ size_t i;
1460
+ const size_t len = lhs->length;
1461
+
1462
+ for (i = 0; i < len; i++) {
1463
+ lhs->data[i].real = lhs->data[i].real * rhs.real;
1464
+ lhs->data[i].imag = lhs->data[i].imag * rhs.imag;
1465
+ }
1466
+
1467
+ return lhs;
1468
+ }
1469
+
1470
+
1471
+ pdlc_complex_buffer_t* pdlc_fb_cb_emult(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1472
+ {
1473
+ size_t i;
1474
+ size_t len = lhs->length;
1475
+
1476
+ if (len > rhs->length)
1477
+ len = rhs->length;
1478
+
1479
+ if (!res)
1480
+ res = pdlc_complex_buffer_new(len);
1481
+ else
1482
+ pdlc_complex_buffer_resize(res, len, 0);
1483
+
1484
+ for (i = 0; i < len; i++) {
1485
+ res->data[i].real = lhs->data[i] * rhs->data[i].real;
1486
+ res->data[i].imag = lhs->data[i] * rhs->data[i].imag;
1487
+ }
1488
+
1489
+ return res;
1490
+ }
1491
+
1492
+
1493
+ pdlc_complex_buffer_t* pdlc_fb_cs_emult(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1494
+ {
1495
+ size_t i;
1496
+ const size_t len = lhs->length;
1497
+
1498
+ if (!res)
1499
+ res = pdlc_complex_buffer_new(len);
1500
+ else
1501
+ pdlc_complex_buffer_resize(res, len, 0);
1502
+
1503
+ for (i = 0; i < len; i++) {
1504
+ res->data[i].real = lhs->data[i] * rhs.real;
1505
+ res->data[i].imag = lhs->data[i] * rhs.imag;
1506
+ }
1507
+
1508
+ return res;
1509
+ }
1510
+
1511
+
1512
+ pdlc_complex_buffer_t* pdlc_cb_fb_emult(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
1513
+ {
1514
+ size_t i;
1515
+ size_t len = lhs->length;
1516
+
1517
+ if (len > rhs->length)
1518
+ len = rhs->length;
1519
+
1520
+ if (!res)
1521
+ res = pdlc_complex_buffer_new(len);
1522
+ else
1523
+ pdlc_complex_buffer_resize(res, len, 0);
1524
+
1525
+ for (i = 0; i < len; i++) {
1526
+ res->data[i].real = lhs->data[i].real * rhs->data[i];
1527
+ res->data[i].imag = lhs->data[i].imag * rhs->data[i];
1528
+ }
1529
+
1530
+ return res;
1531
+ }
1532
+
1533
+
1534
+ pdlc_complex_buffer_t* pdlc_cb_fb_emult_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
1535
+ {
1536
+ size_t i;
1537
+ size_t len = lhs->length;
1538
+
1539
+ if (len > rhs->length)
1540
+ len = rhs->length;
1541
+
1542
+ for (i = 0; i < len; i++) {
1543
+ lhs->data[i].real = lhs->data[i].real * rhs->data[i];
1544
+ lhs->data[i].imag = lhs->data[i].imag * rhs->data[i];
1545
+ }
1546
+
1547
+ return lhs;
1548
+ }
1549
+
1550
+
1551
+ pdlc_complex_buffer_t* pdlc_cb_fs_emult(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
1552
+ {
1553
+ size_t i;
1554
+ const size_t len = lhs->length;
1555
+
1556
+ if (!res)
1557
+ res = pdlc_complex_buffer_new(len);
1558
+ else
1559
+ pdlc_complex_buffer_resize(res, len, 0);
1560
+
1561
+ for (i = 0; i < len; i++) {
1562
+ res->data[i].real = lhs->data[i].real * rhs;
1563
+ res->data[i].imag = lhs->data[i].imag * rhs;
1564
+ }
1565
+
1566
+ return res;
1567
+ }
1568
+
1569
+
1570
+ pdlc_complex_buffer_t* pdlc_cb_fs_emult_inplace(pdlc_complex_buffer_t *lhs, float rhs)
1571
+ {
1572
+ size_t i;
1573
+ const size_t len = lhs->length;
1574
+
1575
+ for (i = 0; i < len; i++) {
1576
+ lhs->data[i].real = lhs->data[i].real * rhs;
1577
+ lhs->data[i].imag = lhs->data[i].imag * rhs;
1578
+ }
1579
+
1580
+ return lhs;
1581
+ }
1582
+
1583
+
1584
+ pdlc_buffer_t* pdlc_fb_fb_div(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
1585
+ {
1586
+ size_t i;
1587
+ size_t len = lhs->length;
1588
+
1589
+ if (len > rhs->length)
1590
+ len = rhs->length;
1591
+
1592
+ if (!res)
1593
+ res = pdlc_buffer_new(len);
1594
+ else
1595
+ pdlc_buffer_resize(res, len, 0);
1596
+
1597
+ for (i = 0; i < len; i++)
1598
+ res->data[i] = lhs->data[i] / rhs->data[i];
1599
+
1600
+ return res;
1601
+ }
1602
+
1603
+
1604
+ pdlc_buffer_t* pdlc_fb_fb_div_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
1605
+ {
1606
+ size_t i;
1607
+ size_t len = lhs->length;
1608
+
1609
+ if (len > rhs->length)
1610
+ len = rhs->length;
1611
+
1612
+ for (i = 0; i < len; i++)
1613
+ lhs->data[i] = lhs->data[i] / rhs->data[i];
1614
+
1615
+ return lhs;
1616
+ }
1617
+
1618
+
1619
+ pdlc_buffer_t* pdlc_fb_fs_div(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
1620
+ {
1621
+ size_t i;
1622
+ const size_t len = lhs->length;
1623
+
1624
+ if (!res)
1625
+ res = pdlc_buffer_new(len);
1626
+ else
1627
+ pdlc_buffer_resize(res, len, 0);
1628
+
1629
+ for (i = 0; i < len; i++)
1630
+ res->data[i] = lhs->data[i] / rhs;
1631
+
1632
+ return res;
1633
+ }
1634
+
1635
+
1636
+ pdlc_buffer_t* pdlc_fb_fs_div_inplace(pdlc_buffer_t *lhs, float rhs)
1637
+ {
1638
+ size_t i;
1639
+ const size_t len = lhs->length;
1640
+
1641
+ for (i = 0; i < len; i++)
1642
+ lhs->data[i] = lhs->data[i] / rhs;
1643
+
1644
+ return lhs;
1645
+ }
1646
+
1647
+
1648
+ pdlc_complex_buffer_t* pdlc_cb_cb_div(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1649
+ {
1650
+ size_t i;
1651
+ pdlc_complex_t tmp;
1652
+ size_t len = lhs->length;
1653
+
1654
+ if (len > rhs->length)
1655
+ len = rhs->length;
1656
+
1657
+ if (!res)
1658
+ res = pdlc_complex_buffer_new(len);
1659
+ else
1660
+ pdlc_complex_buffer_resize(res, len, 0);
1661
+
1662
+ for (i = 0; i < len; i++) {
1663
+ tmp.real = (lhs->data[i].real*rhs->data[i].real + lhs->data[i].imag*rhs->data[i].imag) / (rhs->data[i].real*rhs->data[i].real + rhs->data[i].imag*rhs->data[i].imag);
1664
+ tmp.imag = (lhs->data[i].imag*rhs->data[i].real - lhs->data[i].real*rhs->data[i].imag) / (rhs->data[i].real*rhs->data[i].real + rhs->data[i].imag*rhs->data[i].imag);
1665
+ res->data[i] = tmp;
1666
+ }
1667
+
1668
+ return res;
1669
+ }
1670
+
1671
+
1672
+ pdlc_complex_buffer_t* pdlc_cb_cb_div_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
1673
+ {
1674
+ size_t i;
1675
+ pdlc_complex_t tmp;
1676
+ size_t len = lhs->length;
1677
+
1678
+ if (len > rhs->length)
1679
+ len = rhs->length;
1680
+
1681
+ for (i = 0; i < len; i++) {
1682
+ tmp.real = (lhs->data[i].real*rhs->data[i].real + lhs->data[i].imag*rhs->data[i].imag) / (rhs->data[i].real*rhs->data[i].real + rhs->data[i].imag*rhs->data[i].imag);
1683
+ tmp.imag = (lhs->data[i].imag*rhs->data[i].real - lhs->data[i].real*rhs->data[i].imag) / (rhs->data[i].real*rhs->data[i].real + rhs->data[i].imag*rhs->data[i].imag);
1684
+ lhs->data[i] = tmp;
1685
+ }
1686
+
1687
+ return lhs;
1688
+ }
1689
+
1690
+
1691
+ pdlc_complex_buffer_t* pdlc_cb_cs_div(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1692
+ {
1693
+ size_t i;
1694
+ pdlc_complex_t tmp;
1695
+ const size_t len = lhs->length;
1696
+
1697
+ if (!res)
1698
+ res = pdlc_complex_buffer_new(len);
1699
+ else
1700
+ pdlc_complex_buffer_resize(res, len, 0);
1701
+
1702
+ for (i = 0; i < len; i++) {
1703
+ tmp.real = (lhs->data[i].real*rhs.real + lhs->data[i].imag*rhs.imag) / (rhs.real*rhs.real + rhs.imag*rhs.imag);
1704
+ tmp.imag = (lhs->data[i].imag*rhs.real - lhs->data[i].real*rhs.imag) / (rhs.real*rhs.real + rhs.imag*rhs.imag);
1705
+ res->data[i] = tmp;
1706
+ }
1707
+
1708
+ return res;
1709
+ }
1710
+
1711
+
1712
+ pdlc_complex_buffer_t* pdlc_cb_cs_div_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
1713
+ {
1714
+ size_t i;
1715
+ pdlc_complex_t tmp;
1716
+ const size_t len = lhs->length;
1717
+
1718
+ for (i = 0; i < len; i++) {
1719
+ tmp.real = (lhs->data[i].real*rhs.real + lhs->data[i].imag*rhs.imag) / (rhs.real*rhs.real + rhs.imag*rhs.imag);
1720
+ tmp.imag = (lhs->data[i].imag*rhs.real - lhs->data[i].real*rhs.imag) / (rhs.real*rhs.real + rhs.imag*rhs.imag);
1721
+ lhs->data[i] = tmp;
1722
+ }
1723
+
1724
+ return lhs;
1725
+ }
1726
+
1727
+
1728
+ pdlc_complex_buffer_t* pdlc_fb_cb_div(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1729
+ {
1730
+ size_t i;
1731
+ size_t len = lhs->length;
1732
+
1733
+ if (len > rhs->length)
1734
+ len = rhs->length;
1735
+
1736
+ if (!res)
1737
+ res = pdlc_complex_buffer_new(len);
1738
+ else
1739
+ pdlc_complex_buffer_resize(res, len, 0);
1740
+
1741
+ for (i = 0; i < len; i++) {
1742
+ res->data[i].real = (lhs->data[i]*rhs->data[i].real) / (rhs->data[i].real*rhs->data[i].real + rhs->data[i].imag*rhs->data[i].imag);
1743
+ res->data[i].imag = -lhs->data[i]*rhs->data[i].imag / (rhs->data[i].real*rhs->data[i].real + rhs->data[i].imag*rhs->data[i].imag);
1744
+ }
1745
+
1746
+ return res;
1747
+ }
1748
+
1749
+
1750
+ pdlc_complex_buffer_t* pdlc_fb_cs_div(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1751
+ {
1752
+ size_t i;
1753
+ const size_t len = lhs->length;
1754
+
1755
+ if (!res)
1756
+ res = pdlc_complex_buffer_new(len);
1757
+ else
1758
+ pdlc_complex_buffer_resize(res, len, 0);
1759
+
1760
+ for (i = 0; i < len; i++) {
1761
+ res->data[i].real = (lhs->data[i]*rhs.real) / (rhs.real*rhs.real + rhs.imag*rhs.imag);
1762
+ res->data[i].imag = -lhs->data[i]*rhs.imag / (rhs.real*rhs.real + rhs.imag*rhs.imag);
1763
+ }
1764
+
1765
+ return res;
1766
+ }
1767
+
1768
+
1769
+ pdlc_complex_buffer_t* pdlc_cb_fb_div(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
1770
+ {
1771
+ size_t i;
1772
+ size_t len = lhs->length;
1773
+
1774
+ if (len > rhs->length)
1775
+ len = rhs->length;
1776
+
1777
+ if (!res)
1778
+ res = pdlc_complex_buffer_new(len);
1779
+ else
1780
+ pdlc_complex_buffer_resize(res, len, 0);
1781
+
1782
+ for (i = 0; i < len; i++) {
1783
+ res->data[i].real = (lhs->data[i].real*rhs->data[i]) / (rhs->data[i]*rhs->data[i]);
1784
+ res->data[i].imag = (lhs->data[i].imag*rhs->data[i]) / (rhs->data[i]*rhs->data[i]);
1785
+ }
1786
+
1787
+ return res;
1788
+ }
1789
+
1790
+
1791
+ pdlc_complex_buffer_t* pdlc_cb_fb_div_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
1792
+ {
1793
+ size_t i;
1794
+ size_t len = lhs->length;
1795
+
1796
+ if (len > rhs->length)
1797
+ len = rhs->length;
1798
+
1799
+ for (i = 0; i < len; i++) {
1800
+ lhs->data[i].real = (lhs->data[i].real*rhs->data[i]) / (rhs->data[i]*rhs->data[i]);
1801
+ lhs->data[i].imag = (lhs->data[i].imag*rhs->data[i]) / (rhs->data[i]*rhs->data[i]);
1802
+ }
1803
+
1804
+ return lhs;
1805
+ }
1806
+
1807
+
1808
+ pdlc_complex_buffer_t* pdlc_cb_fs_div(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
1809
+ {
1810
+ size_t i;
1811
+ const size_t len = lhs->length;
1812
+
1813
+ if (!res)
1814
+ res = pdlc_complex_buffer_new(len);
1815
+ else
1816
+ pdlc_complex_buffer_resize(res, len, 0);
1817
+
1818
+ for (i = 0; i < len; i++) {
1819
+ res->data[i].real = (lhs->data[i].real*rhs) / (rhs*rhs);
1820
+ res->data[i].imag = (lhs->data[i].imag*rhs) / (rhs*rhs);
1821
+ }
1822
+
1823
+ return res;
1824
+ }
1825
+
1826
+
1827
+ pdlc_complex_buffer_t* pdlc_cb_fs_div_inplace(pdlc_complex_buffer_t *lhs, float rhs)
1828
+ {
1829
+ size_t i;
1830
+ const size_t len = lhs->length;
1831
+
1832
+ for (i = 0; i < len; i++) {
1833
+ lhs->data[i].real = (lhs->data[i].real*rhs) / (rhs*rhs);
1834
+ lhs->data[i].imag = (lhs->data[i].imag*rhs) / (rhs*rhs);
1835
+ }
1836
+
1837
+ return lhs;
1838
+ }
1839
+
1840
+
1841
+ pdlc_buffer_t* pdlc_fb_fb_ediv(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
1842
+ {
1843
+ size_t i;
1844
+ size_t len = lhs->length;
1845
+
1846
+ if (len > rhs->length)
1847
+ len = rhs->length;
1848
+
1849
+ if (!res)
1850
+ res = pdlc_buffer_new(len);
1851
+ else
1852
+ pdlc_buffer_resize(res, len, 0);
1853
+
1854
+ for (i = 0; i < len; i++)
1855
+ res->data[i] = lhs->data[i] / rhs->data[i];
1856
+
1857
+ return res;
1858
+ }
1859
+
1860
+
1861
+ pdlc_buffer_t* pdlc_fb_fb_ediv_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
1862
+ {
1863
+ size_t i;
1864
+ size_t len = lhs->length;
1865
+
1866
+ if (len > rhs->length)
1867
+ len = rhs->length;
1868
+
1869
+ for (i = 0; i < len; i++)
1870
+ lhs->data[i] = lhs->data[i] / rhs->data[i];
1871
+
1872
+ return lhs;
1873
+ }
1874
+
1875
+
1876
+ pdlc_buffer_t* pdlc_fb_fs_ediv(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
1877
+ {
1878
+ size_t i;
1879
+ const size_t len = lhs->length;
1880
+
1881
+ if (!res)
1882
+ res = pdlc_buffer_new(len);
1883
+ else
1884
+ pdlc_buffer_resize(res, len, 0);
1885
+
1886
+ for (i = 0; i < len; i++)
1887
+ res->data[i] = lhs->data[i] / rhs;
1888
+
1889
+ return res;
1890
+ }
1891
+
1892
+
1893
+ pdlc_buffer_t* pdlc_fb_fs_ediv_inplace(pdlc_buffer_t *lhs, float rhs)
1894
+ {
1895
+ size_t i;
1896
+ const size_t len = lhs->length;
1897
+
1898
+ for (i = 0; i < len; i++)
1899
+ lhs->data[i] = lhs->data[i] / rhs;
1900
+
1901
+ return lhs;
1902
+ }
1903
+
1904
+
1905
+ pdlc_complex_buffer_t* pdlc_cb_cb_ediv(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1906
+ {
1907
+ size_t i;
1908
+ size_t len = lhs->length;
1909
+
1910
+ if (len > rhs->length)
1911
+ len = rhs->length;
1912
+
1913
+ if (!res)
1914
+ res = pdlc_complex_buffer_new(len);
1915
+ else
1916
+ pdlc_complex_buffer_resize(res, len, 0);
1917
+
1918
+ for (i = 0; i < len; i++) {
1919
+ res->data[i].real = lhs->data[i].real / rhs->data[i].real;
1920
+ res->data[i].imag = lhs->data[i].imag / rhs->data[i].imag;
1921
+ }
1922
+
1923
+ return res;
1924
+ }
1925
+
1926
+
1927
+ pdlc_complex_buffer_t* pdlc_cb_cb_ediv_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
1928
+ {
1929
+ size_t i;
1930
+ size_t len = lhs->length;
1931
+
1932
+ if (len > rhs->length)
1933
+ len = rhs->length;
1934
+
1935
+ for (i = 0; i < len; i++) {
1936
+ lhs->data[i].real = lhs->data[i].real / rhs->data[i].real;
1937
+ lhs->data[i].imag = lhs->data[i].imag / rhs->data[i].imag;
1938
+ }
1939
+
1940
+ return lhs;
1941
+ }
1942
+
1943
+
1944
+ pdlc_complex_buffer_t* pdlc_cb_cs_ediv(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
1945
+ {
1946
+ size_t i;
1947
+ const size_t len = lhs->length;
1948
+
1949
+ if (!res)
1950
+ res = pdlc_complex_buffer_new(len);
1951
+ else
1952
+ pdlc_complex_buffer_resize(res, len, 0);
1953
+
1954
+ for (i = 0; i < len; i++) {
1955
+ res->data[i].real = lhs->data[i].real / rhs.real;
1956
+ res->data[i].imag = lhs->data[i].imag / rhs.imag;
1957
+ }
1958
+
1959
+ return res;
1960
+ }
1961
+
1962
+
1963
+ pdlc_complex_buffer_t* pdlc_cb_cs_ediv_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
1964
+ {
1965
+ size_t i;
1966
+ const size_t len = lhs->length;
1967
+
1968
+ for (i = 0; i < len; i++) {
1969
+ lhs->data[i].real = lhs->data[i].real / rhs.real;
1970
+ lhs->data[i].imag = lhs->data[i].imag / rhs.imag;
1971
+ }
1972
+
1973
+ return lhs;
1974
+ }
1975
+
1976
+
1977
+ pdlc_complex_buffer_t* pdlc_fb_cb_ediv(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
1978
+ {
1979
+ size_t i;
1980
+ size_t len = lhs->length;
1981
+
1982
+ if (len > rhs->length)
1983
+ len = rhs->length;
1984
+
1985
+ if (!res)
1986
+ res = pdlc_complex_buffer_new(len);
1987
+ else
1988
+ pdlc_complex_buffer_resize(res, len, 0);
1989
+
1990
+ for (i = 0; i < len; i++) {
1991
+ res->data[i].real = lhs->data[i] / rhs->data[i].real;
1992
+ res->data[i].imag = lhs->data[i] / rhs->data[i].imag;
1993
+ }
1994
+
1995
+ return res;
1996
+ }
1997
+
1998
+
1999
+ pdlc_complex_buffer_t* pdlc_fb_cs_ediv(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
2000
+ {
2001
+ size_t i;
2002
+ const size_t len = lhs->length;
2003
+
2004
+ if (!res)
2005
+ res = pdlc_complex_buffer_new(len);
2006
+ else
2007
+ pdlc_complex_buffer_resize(res, len, 0);
2008
+
2009
+ for (i = 0; i < len; i++) {
2010
+ res->data[i].real = lhs->data[i] / rhs.real;
2011
+ res->data[i].imag = lhs->data[i] / rhs.imag;
2012
+ }
2013
+
2014
+ return res;
2015
+ }
2016
+
2017
+
2018
+ pdlc_complex_buffer_t* pdlc_cb_fb_ediv(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
2019
+ {
2020
+ size_t i;
2021
+ size_t len = lhs->length;
2022
+
2023
+ if (len > rhs->length)
2024
+ len = rhs->length;
2025
+
2026
+ if (!res)
2027
+ res = pdlc_complex_buffer_new(len);
2028
+ else
2029
+ pdlc_complex_buffer_resize(res, len, 0);
2030
+
2031
+ for (i = 0; i < len; i++) {
2032
+ res->data[i].real = lhs->data[i].real / rhs->data[i];
2033
+ res->data[i].imag = lhs->data[i].imag / rhs->data[i];
2034
+ }
2035
+
2036
+ return res;
2037
+ }
2038
+
2039
+
2040
+ pdlc_complex_buffer_t* pdlc_cb_fb_ediv_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
2041
+ {
2042
+ size_t i;
2043
+ size_t len = lhs->length;
2044
+
2045
+ if (len > rhs->length)
2046
+ len = rhs->length;
2047
+
2048
+ for (i = 0; i < len; i++) {
2049
+ lhs->data[i].real = lhs->data[i].real / rhs->data[i];
2050
+ lhs->data[i].imag = lhs->data[i].imag / rhs->data[i];
2051
+ }
2052
+
2053
+ return lhs;
2054
+ }
2055
+
2056
+
2057
+ pdlc_complex_buffer_t* pdlc_cb_fs_ediv(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
2058
+ {
2059
+ size_t i;
2060
+ const size_t len = lhs->length;
2061
+
2062
+ if (!res)
2063
+ res = pdlc_complex_buffer_new(len);
2064
+ else
2065
+ pdlc_complex_buffer_resize(res, len, 0);
2066
+
2067
+ for (i = 0; i < len; i++) {
2068
+ res->data[i].real = lhs->data[i].real / rhs;
2069
+ res->data[i].imag = lhs->data[i].imag / rhs;
2070
+ }
2071
+
2072
+ return res;
2073
+ }
2074
+
2075
+
2076
+ pdlc_complex_buffer_t* pdlc_cb_fs_ediv_inplace(pdlc_complex_buffer_t *lhs, float rhs)
2077
+ {
2078
+ size_t i;
2079
+ const size_t len = lhs->length;
2080
+
2081
+ for (i = 0; i < len; i++) {
2082
+ lhs->data[i].real = lhs->data[i].real / rhs;
2083
+ lhs->data[i].imag = lhs->data[i].imag / rhs;
2084
+ }
2085
+
2086
+ return lhs;
2087
+ }
2088
+
2089
+
2090
+ pdlc_buffer_t* pdlc_fb_fb_pow(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
2091
+ {
2092
+ size_t i;
2093
+ size_t len = lhs->length;
2094
+
2095
+ if (len > rhs->length)
2096
+ len = rhs->length;
2097
+
2098
+ if (!res)
2099
+ res = pdlc_buffer_new(len);
2100
+ else
2101
+ pdlc_buffer_resize(res, len, 0);
2102
+
2103
+ for (i = 0; i < len; i++)
2104
+ res->data[i] = powf(lhs->data[i], rhs->data[i]);
2105
+
2106
+ return res;
2107
+ }
2108
+
2109
+
2110
+ pdlc_buffer_t* pdlc_fb_fb_pow_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
2111
+ {
2112
+ size_t i;
2113
+ size_t len = lhs->length;
2114
+
2115
+ if (len > rhs->length)
2116
+ len = rhs->length;
2117
+
2118
+ for (i = 0; i < len; i++)
2119
+ lhs->data[i] = powf(lhs->data[i], rhs->data[i]);
2120
+
2121
+ return lhs;
2122
+ }
2123
+
2124
+
2125
+ pdlc_buffer_t* pdlc_fb_fs_pow(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
2126
+ {
2127
+ size_t i;
2128
+ const size_t len = lhs->length;
2129
+
2130
+ if (!res)
2131
+ res = pdlc_buffer_new(len);
2132
+ else
2133
+ pdlc_buffer_resize(res, len, 0);
2134
+
2135
+ for (i = 0; i < len; i++)
2136
+ res->data[i] = powf(lhs->data[i], rhs);
2137
+
2138
+ return res;
2139
+ }
2140
+
2141
+
2142
+ pdlc_buffer_t* pdlc_fb_fs_pow_inplace(pdlc_buffer_t *lhs, float rhs)
2143
+ {
2144
+ size_t i;
2145
+ const size_t len = lhs->length;
2146
+
2147
+ for (i = 0; i < len; i++)
2148
+ lhs->data[i] = powf(lhs->data[i], rhs);
2149
+
2150
+ return lhs;
2151
+ }
2152
+
2153
+
2154
+ pdlc_complex_buffer_t* pdlc_cb_fb_pow(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
2155
+ {
2156
+ size_t i;
2157
+ pdlc_complex_t tmp;
2158
+ size_t len = lhs->length;
2159
+
2160
+ if (len > rhs->length)
2161
+ len = rhs->length;
2162
+
2163
+ if (!res)
2164
+ res = pdlc_complex_buffer_new(len);
2165
+ else
2166
+ pdlc_complex_buffer_resize(res, len, 0);
2167
+
2168
+ for (i = 0; i < len; i++) {
2169
+ tmp.real = powf(hypotf(lhs->data[i].real, lhs->data[i].imag), rhs->data[i]);
2170
+ tmp.imag = atan2f(lhs->data[i].imag, lhs->data[i].real) * rhs->data[i];
2171
+ res->data[i].real = tmp.real * cosf(tmp.imag);
2172
+ res->data[i].imag = tmp.real * sinf(tmp.imag);
2173
+ }
2174
+
2175
+ return res;
2176
+ }
2177
+
2178
+
2179
+ pdlc_complex_buffer_t* pdlc_cb_fb_pow_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
2180
+ {
2181
+ size_t i;
2182
+ pdlc_complex_t tmp;
2183
+ size_t len = lhs->length;
2184
+
2185
+ if (len > rhs->length)
2186
+ len = rhs->length;
2187
+
2188
+ for (i = 0; i < len; i++) {
2189
+ tmp.real = powf(hypotf(lhs->data[i].real, lhs->data[i].imag), rhs->data[i]);
2190
+ tmp.imag = atan2f(lhs->data[i].imag, lhs->data[i].real) * rhs->data[i];
2191
+ lhs->data[i].real = tmp.real * cosf(tmp.imag);
2192
+ lhs->data[i].imag = tmp.real * sinf(tmp.imag);
2193
+ }
2194
+
2195
+ return lhs;
2196
+ }
2197
+
2198
+
2199
+ pdlc_complex_buffer_t* pdlc_cb_fs_pow(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
2200
+ {
2201
+ size_t i;
2202
+ pdlc_complex_t tmp;
2203
+ const size_t len = lhs->length;
2204
+
2205
+ if (!res)
2206
+ res = pdlc_complex_buffer_new(len);
2207
+ else
2208
+ pdlc_complex_buffer_resize(res, len, 0);
2209
+
2210
+ for (i = 0; i < len; i++) {
2211
+ tmp.real = powf(hypotf(lhs->data[i].real, lhs->data[i].imag), rhs);
2212
+ tmp.imag = atan2f(lhs->data[i].imag, lhs->data[i].real) * rhs;
2213
+ res->data[i].real = tmp.real * cosf(tmp.imag);
2214
+ res->data[i].imag = tmp.real * sinf(tmp.imag);
2215
+ }
2216
+
2217
+ return res;
2218
+ }
2219
+
2220
+
2221
+ pdlc_complex_buffer_t* pdlc_cb_fs_pow_inplace(pdlc_complex_buffer_t *lhs, float rhs)
2222
+ {
2223
+ size_t i;
2224
+ pdlc_complex_t tmp;
2225
+ const size_t len = lhs->length;
2226
+
2227
+ for (i = 0; i < len; i++) {
2228
+ tmp.real = powf(hypotf(lhs->data[i].real, lhs->data[i].imag), rhs);
2229
+ tmp.imag = atan2f(lhs->data[i].imag, lhs->data[i].real) * rhs;
2230
+ lhs->data[i].real = tmp.real * cosf(tmp.imag);
2231
+ lhs->data[i].imag = tmp.real * sinf(tmp.imag);
2232
+ }
2233
+
2234
+ return lhs;
2235
+ }
2236
+
2237
+
2238
+ pdlc_buffer_t* pdlc_fb_fb_epow(const pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_buffer_t *res)
2239
+ {
2240
+ size_t i;
2241
+ size_t len = lhs->length;
2242
+
2243
+ if (len > rhs->length)
2244
+ len = rhs->length;
2245
+
2246
+ if (!res)
2247
+ res = pdlc_buffer_new(len);
2248
+ else
2249
+ pdlc_buffer_resize(res, len, 0);
2250
+
2251
+ for (i = 0; i < len; i++)
2252
+ res->data[i] = powf(lhs->data[i], rhs->data[i]);
2253
+
2254
+ return res;
2255
+ }
2256
+
2257
+
2258
+ pdlc_buffer_t* pdlc_fb_fb_epow_inplace(pdlc_buffer_t *lhs, const pdlc_buffer_t *rhs)
2259
+ {
2260
+ size_t i;
2261
+ size_t len = lhs->length;
2262
+
2263
+ if (len > rhs->length)
2264
+ len = rhs->length;
2265
+
2266
+ for (i = 0; i < len; i++)
2267
+ lhs->data[i] = powf(lhs->data[i], rhs->data[i]);
2268
+
2269
+ return lhs;
2270
+ }
2271
+
2272
+
2273
+ pdlc_buffer_t* pdlc_fb_fs_epow(const pdlc_buffer_t *lhs, float rhs, pdlc_buffer_t *res)
2274
+ {
2275
+ size_t i;
2276
+ const size_t len = lhs->length;
2277
+
2278
+ if (!res)
2279
+ res = pdlc_buffer_new(len);
2280
+ else
2281
+ pdlc_buffer_resize(res, len, 0);
2282
+
2283
+ for (i = 0; i < len; i++)
2284
+ res->data[i] = powf(lhs->data[i], rhs);
2285
+
2286
+ return res;
2287
+ }
2288
+
2289
+
2290
+ pdlc_buffer_t* pdlc_fb_fs_epow_inplace(pdlc_buffer_t *lhs, float rhs)
2291
+ {
2292
+ size_t i;
2293
+ const size_t len = lhs->length;
2294
+
2295
+ for (i = 0; i < len; i++)
2296
+ lhs->data[i] = powf(lhs->data[i], rhs);
2297
+
2298
+ return lhs;
2299
+ }
2300
+
2301
+
2302
+ pdlc_complex_buffer_t* pdlc_cb_cb_epow(const pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
2303
+ {
2304
+ size_t i;
2305
+ size_t len = lhs->length;
2306
+
2307
+ if (len > rhs->length)
2308
+ len = rhs->length;
2309
+
2310
+ if (!res)
2311
+ res = pdlc_complex_buffer_new(len);
2312
+ else
2313
+ pdlc_complex_buffer_resize(res, len, 0);
2314
+
2315
+ for (i = 0; i < len; i++) {
2316
+ res->data[i].real = powf(lhs->data[i].real, rhs->data[i].real);
2317
+ res->data[i].imag = powf(lhs->data[i].imag, rhs->data[i].imag);
2318
+ }
2319
+
2320
+ return res;
2321
+ }
2322
+
2323
+
2324
+ pdlc_complex_buffer_t* pdlc_cb_cb_epow_inplace(pdlc_complex_buffer_t *lhs, const pdlc_complex_buffer_t *rhs)
2325
+ {
2326
+ size_t i;
2327
+ size_t len = lhs->length;
2328
+
2329
+ if (len > rhs->length)
2330
+ len = rhs->length;
2331
+
2332
+ for (i = 0; i < len; i++) {
2333
+ lhs->data[i].real = powf(lhs->data[i].real, rhs->data[i].real);
2334
+ lhs->data[i].imag = powf(lhs->data[i].imag, rhs->data[i].imag);
2335
+ }
2336
+
2337
+ return lhs;
2338
+ }
2339
+
2340
+
2341
+ pdlc_complex_buffer_t* pdlc_cb_cs_epow(const pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
2342
+ {
2343
+ size_t i;
2344
+ const size_t len = lhs->length;
2345
+
2346
+ if (!res)
2347
+ res = pdlc_complex_buffer_new(len);
2348
+ else
2349
+ pdlc_complex_buffer_resize(res, len, 0);
2350
+
2351
+ for (i = 0; i < len; i++) {
2352
+ res->data[i].real = powf(lhs->data[i].real, rhs.real);
2353
+ res->data[i].imag = powf(lhs->data[i].imag, rhs.imag);
2354
+ }
2355
+
2356
+ return res;
2357
+ }
2358
+
2359
+
2360
+ pdlc_complex_buffer_t* pdlc_cb_cs_epow_inplace(pdlc_complex_buffer_t *lhs, pdlc_complex_t rhs)
2361
+ {
2362
+ size_t i;
2363
+ const size_t len = lhs->length;
2364
+
2365
+ for (i = 0; i < len; i++) {
2366
+ lhs->data[i].real = powf(lhs->data[i].real, rhs.real);
2367
+ lhs->data[i].imag = powf(lhs->data[i].imag, rhs.imag);
2368
+ }
2369
+
2370
+ return lhs;
2371
+ }
2372
+
2373
+
2374
+ pdlc_complex_buffer_t* pdlc_fb_cb_epow(const pdlc_buffer_t *lhs, const pdlc_complex_buffer_t *rhs, pdlc_complex_buffer_t *res)
2375
+ {
2376
+ size_t i;
2377
+ size_t len = lhs->length;
2378
+
2379
+ if (len > rhs->length)
2380
+ len = rhs->length;
2381
+
2382
+ if (!res)
2383
+ res = pdlc_complex_buffer_new(len);
2384
+ else
2385
+ pdlc_complex_buffer_resize(res, len, 0);
2386
+
2387
+ for (i = 0; i < len; i++) {
2388
+ res->data[i].real = powf(lhs->data[i], rhs->data[i].real);
2389
+ res->data[i].imag = powf(lhs->data[i], rhs->data[i].imag);
2390
+ }
2391
+
2392
+ return res;
2393
+ }
2394
+
2395
+
2396
+ pdlc_complex_buffer_t* pdlc_fb_cs_epow(const pdlc_buffer_t *lhs, pdlc_complex_t rhs, pdlc_complex_buffer_t *res)
2397
+ {
2398
+ size_t i;
2399
+ const size_t len = lhs->length;
2400
+
2401
+ if (!res)
2402
+ res = pdlc_complex_buffer_new(len);
2403
+ else
2404
+ pdlc_complex_buffer_resize(res, len, 0);
2405
+
2406
+ for (i = 0; i < len; i++) {
2407
+ res->data[i].real = powf(lhs->data[i], rhs.real);
2408
+ res->data[i].imag = powf(lhs->data[i], rhs.imag);
2409
+ }
2410
+
2411
+ return res;
2412
+ }
2413
+
2414
+
2415
+ pdlc_complex_buffer_t* pdlc_cb_fb_epow(const pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs, pdlc_complex_buffer_t *res)
2416
+ {
2417
+ size_t i;
2418
+ size_t len = lhs->length;
2419
+
2420
+ if (len > rhs->length)
2421
+ len = rhs->length;
2422
+
2423
+ if (!res)
2424
+ res = pdlc_complex_buffer_new(len);
2425
+ else
2426
+ pdlc_complex_buffer_resize(res, len, 0);
2427
+
2428
+ for (i = 0; i < len; i++) {
2429
+ res->data[i].real = powf(lhs->data[i].real, rhs->data[i]);
2430
+ res->data[i].imag = powf(lhs->data[i].imag, rhs->data[i]);
2431
+ }
2432
+
2433
+ return res;
2434
+ }
2435
+
2436
+
2437
+ pdlc_complex_buffer_t* pdlc_cb_fb_epow_inplace(pdlc_complex_buffer_t *lhs, const pdlc_buffer_t *rhs)
2438
+ {
2439
+ size_t i;
2440
+ size_t len = lhs->length;
2441
+
2442
+ if (len > rhs->length)
2443
+ len = rhs->length;
2444
+
2445
+ for (i = 0; i < len; i++) {
2446
+ lhs->data[i].real = powf(lhs->data[i].real, rhs->data[i]);
2447
+ lhs->data[i].imag = powf(lhs->data[i].imag, rhs->data[i]);
2448
+ }
2449
+
2450
+ return lhs;
2451
+ }
2452
+
2453
+
2454
+ pdlc_complex_buffer_t* pdlc_cb_fs_epow(const pdlc_complex_buffer_t *lhs, float rhs, pdlc_complex_buffer_t *res)
2455
+ {
2456
+ size_t i;
2457
+ const size_t len = lhs->length;
2458
+
2459
+ if (!res)
2460
+ res = pdlc_complex_buffer_new(len);
2461
+ else
2462
+ pdlc_complex_buffer_resize(res, len, 0);
2463
+
2464
+ for (i = 0; i < len; i++) {
2465
+ res->data[i].real = powf(lhs->data[i].real, rhs);
2466
+ res->data[i].imag = powf(lhs->data[i].imag, rhs);
2467
+ }
2468
+
2469
+ return res;
2470
+ }
2471
+
2472
+
2473
+ pdlc_complex_buffer_t* pdlc_cb_fs_epow_inplace(pdlc_complex_buffer_t *lhs, float rhs)
2474
+ {
2475
+ size_t i;
2476
+ const size_t len = lhs->length;
2477
+
2478
+ for (i = 0; i < len; i++) {
2479
+ lhs->data[i].real = powf(lhs->data[i].real, rhs);
2480
+ lhs->data[i].imag = powf(lhs->data[i].imag, rhs);
2481
+ }
2482
+
2483
+ return lhs;
2484
+ }
2485
+
2486
+