-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathAlgLibInternal.h
587 lines (550 loc) · 31.6 KB
/
AlgLibInternal.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
// ALGLIB++
// Based on ALGLIB: Copyright (c) Sergey Bochkanov (ALGLIB project).
// Revisions Copyright (c) Lydia Marie Williamson, Mark Hopkins Consulting
// Source License:
// This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation (www.fsf.org);
// either version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU General Public License for more details.
//
// A copy of the GNU General Public License is available at http://www.fsf.org/licensing/licenses
#ifndef OnceOnlyAlgLibInternal_h
#define OnceOnlyAlgLibInternal_h
#include "Ap.h"
// === APSERV Package ===
namespace alglib_impl {
struct apbuffers {
ae_vector ba0;
ae_vector ia0;
ae_vector ia1;
ae_vector ia2;
ae_vector ia3;
ae_vector ra0;
ae_vector ra1;
ae_vector ra2;
ae_vector ra3;
ae_matrix rm0;
ae_matrix rm1;
};
void apbuffers_init(void *_p, bool make_automatic);
void apbuffers_copy(void *_dst, const void *_src, bool make_automatic);
void apbuffers_free(void *_p, bool make_automatic);
// typedef ae_vector BVector; //(@) In Ap.h.
void BVector_init(void *_p, bool make_automatic);
void BVector_copy(void *_dst, const void *_src, bool make_automatic);
void BVector_free(void *_p, bool make_automatic);
// typedef ae_vector ZVector; //(@) In Ap.h.
void ZVector_init(void *_p, bool make_automatic);
void ZVector_copy(void *_dst, const void *_src, bool make_automatic);
void ZVector_free(void *_p, bool make_automatic);
// typedef ae_vector RVector; //(@) In Ap.h.
void RVector_init(void *_p, bool make_automatic);
void RVector_copy(void *_dst, const void *_src, bool make_automatic);
void RVector_free(void *_p, bool make_automatic);
struct nbpool {
ae_int_t n;
ae_int_t temporariescount;
ae_shared_pool sourcepool;
ae_shared_pool temporarypool;
BVector seed0;
BVector seedn;
};
void nbpool_init(void *_p, bool make_automatic);
void nbpool_copy(void *_dst, const void *_src, bool make_automatic);
void nbpool_free(void *_p, bool make_automatic);
struct nipool {
ae_int_t n;
ae_int_t temporariescount;
ae_shared_pool sourcepool;
ae_shared_pool temporarypool;
ZVector seed0;
ZVector seedn;
};
void nipool_init(void *_p, bool make_automatic);
void nipool_copy(void *_dst, const void *_src, bool make_automatic);
void nipool_free(void *_p, bool make_automatic);
struct nrpool {
ae_int_t n;
ae_int_t temporariescount;
ae_shared_pool sourcepool;
ae_shared_pool temporarypool;
RVector seed0;
RVector seedn;
};
void nrpool_init(void *_p, bool make_automatic);
void nrpool_copy(void *_dst, const void *_src, bool make_automatic);
void nrpool_free(void *_p, bool make_automatic);
struct savgcounter {
double rsum;
double rcnt;
double prior;
};
void savgcounter_init(void *_p, bool make_automatic);
void savgcounter_copy(void *_dst, const void *_src, bool make_automatic);
void savgcounter_free(void *_p, bool make_automatic);
double coalesce(double a, double b);
ae_int_t coalescei(ae_int_t a, ae_int_t b);
double logbase2(double x);
// Test number A for equality to B (or to 0.0) within the range Tiny; inclusive for *At*().
// Tiny > 0; and for the *At*() cases, Tiny == 0.0 is also allowed.
//(@) Originally: approxequal(double A, double B, double Tiny);
//(@) AlgLib: Copyright 02.12.2009 by Sergey Bochkanov
static inline bool NearAtR(double A, double B, double Tiny) { return fabs(A - B) <= Tiny; }
static inline bool NearAtCR(complex A, double B, double Tiny) { return abscomplex(ae_c_sub_d(A, B)) <= Tiny; }
static inline bool NearAtC(complex A, complex B, double Tiny) { return abscomplex(ae_c_sub(A, B)) <= Tiny; }
static inline bool NearR(double A, double B, double Tiny) { return fabs(A - B) < Tiny; }
static inline bool NearC(complex A, complex B, double Tiny) { return abscomplex(ae_c_sub(A, B)) < Tiny; }
static inline bool SmallAtR(double A, double Tiny) { return fabs(A) <= Tiny; }
static inline bool SmallAtC(complex A, double Tiny) { return abscomplex(A) <= Tiny; }
static inline bool SmallR(double A, double Tiny) { return fabs(A) < Tiny; }
static inline bool SmallC(complex A, double Tiny) { return abscomplex(A) < Tiny; }
void taskgenint1d(double a, double b, ae_int_t n, RVector *x, RVector *y);
void taskgenint1dequidist(double a, double b, ae_int_t n, RVector *x, RVector *y);
void taskgenint1dcheb1(double a, double b, ae_int_t n, RVector *x, RVector *y);
void taskgenint1dcheb2(double a, double b, ae_int_t n, RVector *x, RVector *y);
bool aredistinct(RVector *x, ae_int_t n);
void setlengthzero(RVector *x, ae_int_t n);
void vectorsetlengthatleast(ae_vector *x, ae_int_t n);
void matrixsetlengthatleast(ae_matrix *x, ae_int_t m, ae_int_t n);
void bvectorgrowto(BVector *x, ae_int_t n);
void ivectorgrowto(ZVector *x, ae_int_t n);
void rvectorgrowto(RVector *x, ae_int_t n);
void rmatrixgrowcolsto(RMatrix *a, ae_int_t n, ae_int_t minrows);
void rmatrixgrowrowsto(RMatrix *a, ae_int_t n, ae_int_t mincols);
void ivectorresize(ZVector *x, ae_int_t n);
void rvectorresize(RVector *x, ae_int_t n);
void imatrixresize(ZMatrix *x, ae_int_t m, ae_int_t n);
void rmatrixresize(RMatrix *x, ae_int_t m, ae_int_t n);
bool isfinitevector(RVector *x, ae_int_t n);
bool isfinitecvector(CVector *z, ae_int_t n);
bool isfiniteornanvector(RVector *x, ae_int_t n);
bool apservisfinitematrix(RMatrix *x, ae_int_t m, ae_int_t n);
bool apservisfinitecmatrix(CMatrix *x, ae_int_t m, ae_int_t n);
bool isfinitertrmatrix(RMatrix *x, ae_int_t n, bool isupper);
bool apservisfinitectrmatrix(CMatrix *x, ae_int_t n, bool isupper);
bool apservisfiniteornanmatrix(RMatrix *x, ae_int_t m, ae_int_t n);
double safepythag2(double x, double y);
double safepythag3(double x, double y, double z);
ae_int_t saferdiv(double x, double y, double *r);
double safeminposrv(double x, double y, double v);
void apperiodicmap(double *x, double a, double b, double *k);
double randomnormal();
void randomunit(ae_int_t n, RVector *x);
void swapb(bool *v0, bool *v1);
void swapi(ae_int_t *v0, ae_int_t *v1);
void swapr(double *v0, double *v1);
void swapc(complex *v0, complex *v1);
void swapcols(RMatrix *a, ae_int_t j0, ae_int_t j1, ae_int_t nrows);
void swaprows(RMatrix *a, ae_int_t i0, ae_int_t i1, ae_int_t ncols);
void swapentries(RVector *a, ae_int_t i0, ae_int_t i1, ae_int_t entrywidth);
void swapentriesb(BVector *a, ae_int_t i0, ae_int_t i1, ae_int_t entrywidth);
void swapelementsi(ZVector *a, ae_int_t i0, ae_int_t i1);
void swapelements(RVector *a, ae_int_t i0, ae_int_t i1);
double possign(double x);
ae_int_t idivup(ae_int_t a, ae_int_t b);
void alloccomplex(ae_serializer *s, complex v);
void serializecomplex(ae_serializer *s, complex v);
complex unserializecomplex(ae_serializer *s);
void allocbooleanarray(ae_serializer *s, BVector *v, ae_int_t n);
void serializebooleanarray(ae_serializer *s, BVector *v, ae_int_t n);
void unserializebooleanarray(ae_serializer *s, BVector *v);
void allocrealarray(ae_serializer *s, RVector *v, ae_int_t n);
void serializerealarray(ae_serializer *s, RVector *v, ae_int_t n);
void unserializerealarray(ae_serializer *s, RVector *v);
void allocintegerarray(ae_serializer *s, ZVector *v, ae_int_t n);
void serializeintegerarray(ae_serializer *s, ZVector *v, ae_int_t n);
void unserializeintegerarray(ae_serializer *s, ZVector *v);
void allocrealmatrix(ae_serializer *s, RMatrix *v, ae_int_t n0, ae_int_t n1);
void serializerealmatrix(ae_serializer *s, RMatrix *v, ae_int_t n0, ae_int_t n1);
void unserializerealmatrix(ae_serializer *s, RMatrix *v);
void copybooleanarray(BVector *src, BVector *dst);
void copyintegerarray(ZVector *src, ZVector *dst);
void copyrealarray(RVector *src, RVector *dst);
void copyrealmatrix(RMatrix *src, RMatrix *dst);
void unsetintegerarray(ZVector *a);
void unsetrealarray(RVector *a);
void unsetrealmatrix(RMatrix *a);
void nbpoolinit(nbpool *pool, ae_int_t n);
void nbpoolretrieve(nbpool *pool, BVector *a);
void nbpoolrecycle(nbpool *pool, BVector *a);
void nipoolinit(nipool *pool, ae_int_t n);
void nipoolretrieve(nipool *pool, ZVector *a);
void nipoolrecycle(nipool *pool, ZVector *a);
void nrpoolinit(nrpool *pool, ae_int_t n);
void nrpoolretrieve(nrpool *pool, RVector *a);
void nrpoolrecycle(nrpool *pool, RVector *a);
ae_int_t chunkscount(ae_int_t tasksize, ae_int_t chunksize);
ae_int_t tiledsplit(ae_int_t tasksize, ae_int_t tilesize);
ae_int_t splitlength(ae_int_t tasksize, ae_int_t chunksize);
ae_int_t splitlengtheven(ae_int_t tasksize);
ae_int_t recsearch(ZVector *a, ae_int_t nrec, ae_int_t nheader, ae_int_t i0, ae_int_t i1, ZVector *b);
double sparselevel2density();
ae_int_t matrixtilesizea();
ae_int_t matrixtilesizeb();
double smpactivationlevel();
double spawnlevel();
double minspeedup();
void savgcounterinit(savgcounter *c, double priorvalue);
void savgcounterenqueue(savgcounter *c, double v);
double savgcounterget(savgcounter *c);
} // end of namespace alglib_impl
// === ABLASF Package ===
namespace alglib_impl {
double rdotv(ae_int_t n, RVector *x, RVector *y);
double rdotvr(ae_int_t n, RVector *x, RMatrix *y, ae_int_t iy);
double rdotrr(ae_int_t n, RMatrix *x, ae_int_t ix, RMatrix *y, ae_int_t iy);
double rdotv2(ae_int_t n, RVector *x);
void raddv(ae_int_t n, double alpha, RVector *x, RVector *y);
void raddvr(ae_int_t n, double alpha, RVector *x, RMatrix *y, ae_int_t iy);
void raddrv(ae_int_t n, double alpha, RMatrix *x, ae_int_t ix, RVector *y);
void raddrr(ae_int_t n, double alpha, RMatrix *x, ae_int_t ix, RMatrix *y, ae_int_t iy);
void raddvx(ae_int_t n, double alpha, RVector *x, ae_int_t x0, RVector *y, ae_int_t y0);
void raddvc(ae_int_t n, double alpha, RVector *x, RMatrix *y, ae_int_t jy);
void rmergemulv(ae_int_t n, RVector *x, RVector *y);
void rmergemulvr(ae_int_t n, RVector *x, RMatrix *y, ae_int_t iy);
void rmergemulrv(ae_int_t n, RMatrix *x, ae_int_t ix, RVector *y);
void rmergedivv(ae_int_t n, RVector *x, RVector *y);
void rmergedivvr(ae_int_t n, RVector *x, RMatrix *y, ae_int_t iy);
void rmergedivrv(ae_int_t n, RMatrix *x, ae_int_t ix, RVector *y);
void rmergemaxv(ae_int_t n, RVector *x, RVector *y);
void rmergemaxvr(ae_int_t n, RVector *x, RMatrix *y, ae_int_t iy);
void rmergemaxrv(ae_int_t n, RMatrix *x, ae_int_t ix, RVector *y);
void rmergeminv(ae_int_t n, RVector *x, RVector *y);
void rmergeminvr(ae_int_t n, RVector *x, RMatrix *y, ae_int_t iy);
void rmergeminrv(ae_int_t n, RMatrix *x, ae_int_t ix, RVector *y);
void rsqrtv(ae_int_t n, RVector *y);
void rsqrtr(ae_int_t n, RMatrix *y, ae_int_t iy);
void rmulv(ae_int_t n, double v, RVector *y);
void rmulr(ae_int_t n, double v, RMatrix *y, ae_int_t iy);
void rmulvx(ae_int_t n, double v, RVector *y, ae_int_t y0);
void rmuladdv(ae_int_t n, RVector *x, RVector *y, RVector *z);
void rnegmuladdv(ae_int_t n, RVector *x, RVector *y, RVector *z);
double rmaxv(ae_int_t n, RVector *x);
double rmaxr(ae_int_t n, RMatrix *x, ae_int_t ix);
double rmaxabsv(ae_int_t n, RVector *x);
double rmaxabsr(ae_int_t n, RMatrix *x, ae_int_t ix);
void bsetv(ae_int_t n, bool v, BVector *y);
void isetv(ae_int_t n, ae_int_t v, ZVector *y);
void rsetv(ae_int_t n, double v, RVector *y);
void csetv(ae_int_t n, complex v, CVector *y);
void rsetvx(ae_int_t n, double v, RVector *y, ae_int_t y0);
void rsetm(ae_int_t m, ae_int_t n, double v, RMatrix *y);
void rsetr(ae_int_t n, double v, RMatrix *y, ae_int_t iy);
void rsetc(ae_int_t n, double v, RMatrix *y, ae_int_t jy);
void bsetallocv(ae_int_t n, bool v, BVector *y);
void isetallocv(ae_int_t n, ae_int_t v, ZVector *y);
void rsetallocv(ae_int_t n, double v, RVector *y);
void csetallocv(ae_int_t n, complex v, CVector *y);
void rsetallocm(ae_int_t m, ae_int_t n, double v, RMatrix *y);
void allocv(ae_int_t n, ae_vector *x);
void allocm(ae_int_t m, ae_int_t n, ae_matrix *x);
void bcopyv(ae_int_t n, BVector *x, BVector *y);
void icopyv(ae_int_t n, ZVector *x, ZVector *y);
void rcopyv(ae_int_t n, RVector *x, RVector *y);
void rcopyvr(ae_int_t n, RVector *x, RMatrix *y, ae_int_t iy);
void rcopyrv(ae_int_t n, RMatrix *x, ae_int_t ix, RVector *y);
void rcopyrr(ae_int_t n, RMatrix *x, ae_int_t ix, RMatrix *y, ae_int_t iy);
void icopyvx(ae_int_t n, ZVector *x, ae_int_t x0, ZVector *y, ae_int_t y0);
void rcopyvx(ae_int_t n, RVector *x, ae_int_t x0, RVector *y, ae_int_t y0);
void rcopyvc(ae_int_t n, RVector *x, RMatrix *y, ae_int_t jy);
void rcopycv(ae_int_t n, RMatrix *x, ae_int_t jx, RVector *y);
void rcopym(ae_int_t m, ae_int_t n, RMatrix *x, RMatrix *y);
void rcopymulv(ae_int_t n, double v, RVector *x, RVector *y);
void rcopymulvr(ae_int_t n, double v, RVector *x, RMatrix *y, ae_int_t iy);
void rcopymulvc(ae_int_t n, double v, RVector *x, RMatrix *y, ae_int_t jy);
void rcopymuladdv(ae_int_t n, RVector *x, RVector *y, RVector *z, RVector *w);
void rcopynegmuladdv(ae_int_t n, RVector *x, RVector *y, RVector *z, RVector *w);
void bcopyallocv(ae_int_t n, BVector *x, BVector *y);
void icopyallocv(ae_int_t n, ZVector *x, ZVector *y);
void rcopyallocv(ae_int_t n, RVector *x, RVector *y);
void rcopyallocm(ae_int_t m, ae_int_t n, RMatrix *x, RMatrix *y);
void igrowv(ae_int_t newn, ZVector *x);
void rgrowv(ae_int_t newn, RVector *x);
void rgemv(ae_int_t m, ae_int_t n, double alpha, RMatrix *a, ae_int_t opa, RVector *x, double beta, RVector *y);
void rgemvx(ae_int_t m, ae_int_t n, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, RVector *x, ae_int_t ix, double beta, RVector *y, ae_int_t iy);
void rger(ae_int_t m, ae_int_t n, double alpha, RVector *u, RVector *v, RMatrix *a);
void rtrsvx(ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, bool isupper, bool isunit, ae_int_t opa, RVector *x, ae_int_t ix);
bool rmatrixgerf(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, double ralpha, RVector *u, ae_int_t iu, RVector *v, ae_int_t iv);
bool rmatrixrank1f(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, RVector *u, ae_int_t iu, RVector *v, ae_int_t iv);
bool cmatrixrank1f(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t ia, ae_int_t ja, CVector *u, ae_int_t iu, CVector *v, ae_int_t iv);
bool rmatrixlefttrsmf(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, RMatrix *x, ae_int_t i2, ae_int_t j2);
bool cmatrixlefttrsmf(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, CMatrix *x, ae_int_t i2, ae_int_t j2);
bool rmatrixrighttrsmf(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, RMatrix *x, ae_int_t i2, ae_int_t j2);
bool cmatrixrighttrsmf(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, CMatrix *x, ae_int_t i2, ae_int_t j2);
bool rmatrixsyrkf(ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc, bool isupper);
bool cmatrixherkf(ae_int_t n, ae_int_t k, double alpha, CMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, double beta, CMatrix *c, ae_int_t ic, ae_int_t jc, bool isupper);
bool rmatrixgemmf(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, RMatrix *b, ae_int_t ib, ae_int_t jb, ae_int_t opb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
bool cmatrixgemmf(ae_int_t m, ae_int_t n, ae_int_t k, complex alpha, CMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, CMatrix *b, ae_int_t ib, ae_int_t jb, ae_int_t opb, complex beta, CMatrix *c, ae_int_t ic, ae_int_t jc);
void rmatrixgemmk44v00(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, RMatrix *b, ae_int_t ib, ae_int_t jb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
void rmatrixgemmk44v01(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, RMatrix *b, ae_int_t ib, ae_int_t jb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
void rmatrixgemmk44v10(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, RMatrix *b, ae_int_t ib, ae_int_t jb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
void rmatrixgemmk44v11(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, RMatrix *b, ae_int_t ib, ae_int_t jb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
void rmatrixgemmk(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, RMatrix *b, ae_int_t ib, ae_int_t jb, ae_int_t opb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
void cmatrixgemmk(ae_int_t m, ae_int_t n, ae_int_t k, complex alpha, CMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, CMatrix *b, ae_int_t ib, ae_int_t jb, ae_int_t opb, complex beta, CMatrix *c, ae_int_t ic, ae_int_t jc);
} // end of namespace alglib_impl
// === HBLAS Package ===
namespace alglib_impl {
void hermitianmatrixvectormultiply(CMatrix *a, bool isupper, ae_int_t i1, ae_int_t i2, CVector *x, complex alpha, CVector *y);
void hermitianrank2update(CMatrix *a, bool isupper, ae_int_t i1, ae_int_t i2, CVector *x, CVector *y, CVector *t, complex alpha);
} // end of namespace alglib_impl
// === CREFLECTIONS Package ===
namespace alglib_impl {
void complexgeneratereflection(CVector *x, ae_int_t n, complex *tau);
void complexapplyreflectionfromtheleft(CMatrix *c, complex tau, CVector *v, ae_int_t m1, ae_int_t m2, ae_int_t n1, ae_int_t n2, CVector *work);
void complexapplyreflectionfromtheright(CMatrix *c, complex tau, CVector *v, ae_int_t m1, ae_int_t m2, ae_int_t n1, ae_int_t n2, CVector *work);
} // end of namespace alglib_impl
// === SBLAS Package ===
// Depends on: APSERV
namespace alglib_impl {
void symmetricmatrixvectormultiply(RMatrix *a, bool isupper, ae_int_t i1, ae_int_t i2, RVector *x, double alpha, RVector *y);
void symmetricrank2update(RMatrix *a, bool isupper, ae_int_t i1, ae_int_t i2, RVector *x, RVector *y, RVector *t, double alpha);
} // end of namespace alglib_impl
// === ABLASMKL Package ===
namespace alglib_impl {
bool rmatrixgermkl(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, double alpha, RVector *u, ae_int_t iu, RVector *v, ae_int_t iv);
bool rmatrixrank1mkl(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, RVector *u, ae_int_t iu, RVector *v, ae_int_t iv);
bool cmatrixrank1mkl(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t ia, ae_int_t ja, CVector *u, ae_int_t iu, CVector *v, ae_int_t iv);
bool rmatrixmvmkl(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, RVector *x, ae_int_t ix, RVector *y, ae_int_t iy);
bool cmatrixmvmkl(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, CVector *x, ae_int_t ix, CVector *y, ae_int_t iy);
bool rmatrixgemvmkl(ae_int_t m, ae_int_t n, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, RVector *x, ae_int_t ix, double beta, RVector *y, ae_int_t iy);
bool rmatrixtrsvmkl(ae_int_t n, RMatrix *a, ae_int_t ia, ae_int_t ja, bool isupper, bool isunit, ae_int_t opa, RVector *x, ae_int_t ix);
bool rmatrixsymvmkl(ae_int_t n, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, bool isupper, RVector *x, ae_int_t ix, double beta, RVector *y, ae_int_t iy);
bool rmatrixsyrkmkl(ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc, bool isupper);
bool cmatrixherkmkl(ae_int_t n, ae_int_t k, double alpha, CMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, double beta, CMatrix *c, ae_int_t ic, ae_int_t jc, bool isupper);
bool rmatrixgemmmkl(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, RMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, RMatrix *b, ae_int_t ib, ae_int_t jb, ae_int_t opb, double beta, RMatrix *c, ae_int_t ic, ae_int_t jc);
bool cmatrixgemmmkl(ae_int_t m, ae_int_t n, ae_int_t k, complex alpha, CMatrix *a, ae_int_t ia, ae_int_t ja, ae_int_t opa, CMatrix *b, ae_int_t ib, ae_int_t jb, ae_int_t opb, complex beta, CMatrix *c, ae_int_t ic, ae_int_t jc);
bool rmatrixlefttrsmmkl(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, RMatrix *x, ae_int_t i2, ae_int_t j2);
bool cmatrixlefttrsmmkl(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, CMatrix *x, ae_int_t i2, ae_int_t j2);
bool rmatrixrighttrsmmkl(ae_int_t m, ae_int_t n, RMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, RMatrix *x, ae_int_t i2, ae_int_t j2);
bool cmatrixrighttrsmmkl(ae_int_t m, ae_int_t n, CMatrix *a, ae_int_t i1, ae_int_t j1, bool isupper, bool isunit, ae_int_t opa, CMatrix *x, ae_int_t i2, ae_int_t j2);
bool spdmatrixcholeskymkl(RMatrix *a, ae_int_t offs, ae_int_t n, bool isupper, bool *cholresult);
bool rmatrixplumkl(RMatrix *a, ae_int_t offs, ae_int_t m, ae_int_t n, ZVector *pivots);
bool rmatrixbdmkl(RMatrix *a, ae_int_t m, ae_int_t n, RVector *d, RVector *e, RVector *tauq, RVector *taup);
bool rmatrixbdmultiplybymkl(RMatrix *qp, ae_int_t m, ae_int_t n, RVector *tauq, RVector *taup, RMatrix *z, ae_int_t zrows, ae_int_t zcolumns, bool byq, bool fromtheright, bool dotranspose);
bool rmatrixhessenbergmkl(RMatrix *a, ae_int_t n, RVector *tau);
bool rmatrixhessenbergunpackqmkl(RMatrix *a, ae_int_t n, RVector *tau, RMatrix *q);
bool smatrixtdmkl(RMatrix *a, ae_int_t n, bool isupper, RVector *tau, RVector *d, RVector *e);
bool hmatrixtdmkl(CMatrix *a, ae_int_t n, bool isupper, CVector *tau, RVector *d, RVector *e);
bool smatrixtdunpackqmkl(RMatrix *a, ae_int_t n, bool isupper, RVector *tau, RMatrix *q);
bool hmatrixtdunpackqmkl(CMatrix *a, ae_int_t n, bool isupper, CVector *tau, CMatrix *q);
bool rmatrixbdsvdmkl(RVector *d, RVector *e, ae_int_t n, bool isupper, RMatrix *u, ae_int_t nru, RMatrix *c, ae_int_t ncc, RMatrix *vt, ae_int_t ncvt, bool *svdresult);
bool rmatrixinternalschurdecompositionmkl(RMatrix *h, ae_int_t n, ae_int_t tneeded, ae_int_t zneeded, RVector *wr, RVector *wi, RMatrix *z, ae_int_t *info);
bool rmatrixinternaltrevcmkl(RMatrix *t, ae_int_t n, ae_int_t side, ae_int_t howmny, RMatrix *vl, RMatrix *vr, ae_int_t *m, ae_int_t *info);
bool smatrixtdevdmkl(RVector *d, RVector *e, ae_int_t n, ae_int_t zneeded, RMatrix *z, bool *evdresult);
bool sparsegemvcrsmkl(ae_int_t opa, ae_int_t arows, ae_int_t acols, double alpha, RVector *vals, ZVector *cidx, ZVector *ridx, RVector *x, ae_int_t ix, double beta, RVector *y, ae_int_t iy);
} // end of namespace alglib_impl
// === SCODES Package ===
namespace alglib_impl {
ae_int_t getrdfserializationcode();
ae_int_t getkdtreeserializationcode();
ae_int_t getmlpserializationcode();
ae_int_t getmlpeserializationcode();
ae_int_t getrbfserializationcode();
ae_int_t getspline2dserializationcode();
ae_int_t getidwserializationcode();
ae_int_t getsparsematrixserializationcode();
ae_int_t getspline2dwithmissingnodesserializationcode();
ae_int_t getknnserializationcode();
ae_int_t getlptestserializationcode();
} // end of namespace alglib_impl
// === TSORT Package ===
// Depends on: APSERV
namespace alglib_impl {
void tagsortfasti(RVector *a, ZVector *b, RVector *bufa, ZVector *bufb, ae_int_t n);
void tagsortfastr(RVector *a, RVector *b, RVector *bufa, RVector *bufb, ae_int_t n);
void tagsortfast(RVector *a, RVector *bufa, ae_int_t n);
void tagsortmiddleii(ZVector *a, ZVector *b, ae_int_t n, ae_int_t offset = 0);
void tagsortmiddleir(ZVector *a, RVector *b, ae_int_t n, ae_int_t offset = 0);
void tagsortmiddleri(RVector *a, ZVector *b, ae_int_t n, ae_int_t offset = 0);
void tagsortmiddlei(ZVector *a, ae_int_t n, ae_int_t offset = 0);
void tagsortbuf(RVector *a, ae_int_t n, ZVector *p1, ZVector *p2, apbuffers *buf);
void tagsort(RVector *a, ae_int_t n, ZVector *p1, ZVector *p2);
void tagheappushi(RVector *a, ZVector *b, ae_int_t *n, double va, ae_int_t vb);
void tagheapreplacetopi(RVector *a, ZVector *b, ae_int_t n, double va, ae_int_t vb);
void tagheappopi(RVector *a, ZVector *b, ae_int_t *n);
ae_int_t lowerbound(RVector *a, ae_int_t n, double t);
ae_int_t upperbound(RVector *a, ae_int_t n, double t);
} // end of namespace alglib_impl
// === BLAS Package ===
namespace alglib_impl {
double vectornorm2(RVector *x, ae_int_t i1, ae_int_t i2);
ae_int_t vectoridxabsmax(RVector *x, ae_int_t i1, ae_int_t i2);
ae_int_t columnidxabsmax(RMatrix *x, ae_int_t i1, ae_int_t i2, ae_int_t j);
ae_int_t rowidxabsmax(RMatrix *x, ae_int_t j1, ae_int_t j2, ae_int_t i);
double upperhessenberg1norm(RMatrix *a, ae_int_t i1, ae_int_t i2, ae_int_t j1, ae_int_t j2, RVector *work);
void copymatrix(RMatrix *a, ae_int_t is1, ae_int_t is2, ae_int_t js1, ae_int_t js2, RMatrix *b, ae_int_t id1, ae_int_t id2, ae_int_t jd1, ae_int_t jd2);
void inplacetranspose(RMatrix *a, ae_int_t i1, ae_int_t i2, ae_int_t j1, ae_int_t j2, RVector *work);
void copyandtranspose(RMatrix *a, ae_int_t is1, ae_int_t is2, ae_int_t js1, ae_int_t js2, RMatrix *b, ae_int_t id1, ae_int_t id2, ae_int_t jd1, ae_int_t jd2);
void matrixvectormultiply(RMatrix *a, ae_int_t i1, ae_int_t i2, ae_int_t j1, ae_int_t j2, bool trans, RVector *x, ae_int_t ix1, ae_int_t ix2, double alpha, RVector *y, ae_int_t iy1, ae_int_t iy2, double beta);
void matrixmatrixmultiply(RMatrix *a, ae_int_t ai1, ae_int_t ai2, ae_int_t aj1, ae_int_t aj2, bool transa, RMatrix *b, ae_int_t bi1, ae_int_t bi2, ae_int_t bj1, ae_int_t bj2, bool transb, double alpha, RMatrix *c, ae_int_t ci1, ae_int_t ci2, ae_int_t cj1, ae_int_t cj2, double beta, RVector *work);
} // end of namespace alglib_impl
// === ROTATIONS Package ===
namespace alglib_impl {
void applyrotationsfromtheleft(bool isforward, ae_int_t m1, ae_int_t m2, ae_int_t n1, ae_int_t n2, RVector *c, RVector *s, RMatrix *a, RVector *work);
void applyrotationsfromtheright(bool isforward, ae_int_t m1, ae_int_t m2, ae_int_t n1, ae_int_t n2, RVector *c, RVector *s, RMatrix *a, RVector *work);
void generaterotation(double f, double g, double *cs, double *sn, double *r);
} // end of namespace alglib_impl
// === BASICSTATOPS Package ===
// Depends on: TSORT
namespace alglib_impl {
void rankx(RVector *x, ae_int_t n, bool iscentered, apbuffers *buf);
void rankxuntied(RVector *x, ae_int_t n, apbuffers *buf);
} // end of namespace alglib_impl
// === APSTRUCT Package ===
// Depends on: ABLASF
namespace alglib_impl {
struct niset {
ae_int_t n;
ae_int_t nstored;
ae_vector items;
ae_vector locationof;
ae_int_t iteridx;
};
void niset_init(void *_p, bool make_automatic);
void niset_copy(void *_dst, const void *_src, bool make_automatic);
void niset_free(void *_p, bool make_automatic);
void nisinitemptyslow(ae_int_t n, niset *sa);
void nisclear(niset *sa);
void niscopy(niset *ssrc, niset *sdst);
void nisaddelement(niset *sa, ae_int_t k);
void nissubtract1(niset *sa, niset *src);
ae_int_t niscount(niset *sa);
bool nisequal(niset *s0, niset *s1);
void nisstartenumeration(niset *sa);
bool nisenumerate(niset *sa, ae_int_t *i);
} // end of namespace alglib_impl
// === TRLINSOLVE Package ===
namespace alglib_impl {
void safesolvetriangular(RMatrix *a, ae_int_t n, RVector *x, double *s, bool isupper, bool istrans, bool isunit, bool normin, RVector *cnorm);
void rmatrixtrsafesolve(RMatrix *a, ae_int_t n, RVector *x, double *s, bool isupper, bool istrans, bool isunit);
} // end of namespace alglib_impl
// === SAFESOLVE Package ===
namespace alglib_impl {
bool rmatrixscaledtrsafesolve(RMatrix *a, double sa, ae_int_t n, RVector *x, bool isupper, ae_int_t trans, bool isunit, double maxgrowth);
bool cmatrixscaledtrsafesolve(CMatrix *a, double sa, ae_int_t n, CVector *x, bool isupper, ae_int_t trans, bool isunit, double maxgrowth);
} // end of namespace alglib_impl
// === XBLAS Package ===
namespace alglib_impl {
void xdot(RVector *a, RVector *b, ae_int_t n, RVector *temp, double *r, double *rerr);
void xcdot(CVector *a, CVector *b, ae_int_t n, RVector *temp, complex *r, double *rerr);
} // end of namespace alglib_impl
// === LINMIN Package ===
namespace alglib_impl {
struct linminstate {
bool brackt;
bool stage1;
ae_int_t infoc;
double dg;
double dgm;
double dginit;
double dgtest;
double dgx;
double dgxm;
double dgy;
double dgym;
double finit;
double ftest1;
double fm;
double fx;
double fxm;
double fy;
double fym;
double stx;
double sty;
double stmin;
double stmax;
double width;
double width1;
double xtrapf;
};
void linminstate_init(void *_p, bool make_automatic);
void linminstate_copy(void *_dst, const void *_src, bool make_automatic);
void linminstate_free(void *_p, bool make_automatic);
struct armijostate {
bool needf;
ae_vector x;
double f;
ae_int_t n;
ae_vector xbase;
ae_vector s;
double stplen;
double fcur;
double stpmax;
ae_int_t fmax;
ae_int_t nfev;
ae_int_t info;
ae_int_t PQ;
};
void armijostate_init(void *_p, bool make_automatic);
void armijostate_copy(void *_dst, const void *_src, bool make_automatic);
void armijostate_free(void *_p, bool make_automatic);
void linminnormalized(RVector *d, double *stp, ae_int_t n);
void mcstep(double *stx, double *fx, double *dx, double *sty, double *fy, double *dy, double *stp, double fp, double dp, bool *brackt, double stmin, double stmax, ae_int_t *info);
bool mcsrch(ae_int_t n, RVector *x, double f, RVector *g, RVector *s, double *stp, double stpmax, double gtol, ae_int_t *info, ae_int_t *nfev, RVector *wa, linminstate *state, ae_int_t *stage);
void armijocreate(ae_int_t n, RVector *x, double f, RVector *s, double stp, double stpmax, ae_int_t fmax, armijostate *state);
bool armijoiteration(armijostate *state);
void armijoresults(armijostate *state, ae_int_t *info, double *stp, double *f);
} // end of namespace alglib_impl
// === NEARUNITYUNIT Package ===
namespace alglib_impl {
double nulog1p(double x);
double nuexpm1(double x);
double nucosm1(double x); //(@) Not used or tested anywhere.
} // end of namespace alglib_impl
// === NTHEORY Package ===
namespace alglib_impl {
void findprimitiverootandinverse(ae_int_t n, ae_int_t *proot, ae_int_t *invproot);
} // end of namespace alglib_impl
// === FTBASE Package ===
// Depends on: APSERV, NTHEORY
namespace alglib_impl {
struct fasttransformplan {
ae_matrix entries;
ae_vector buffer;
ae_vector precr;
ae_vector preci;
ae_shared_pool bluesteinpool;
};
void fasttransformplan_init(void *_p, bool make_automatic);
void fasttransformplan_copy(void *_dst, const void *_src, bool make_automatic);
void fasttransformplan_free(void *_p, bool make_automatic);
double ftbasegetflopestimate(ae_int_t n);
void ftbasefactorize(ae_int_t n, ae_int_t tasktype, ae_int_t *n1p, ae_int_t *n2p);
bool ftbaseissmooth(ae_int_t n);
ae_int_t ftbasefindsmooth(ae_int_t n);
ae_int_t ftbasefindsmootheven(ae_int_t n);
void ftapplyplan(fasttransformplan *plan, RVector *a, ae_int_t offsa = 0, ae_int_t repcnt = 1);
void ftcomplexfftplan(ae_int_t n, ae_int_t k, fasttransformplan *plan);
} // end of namespace alglib_impl
// === HPCCORES Package ===
namespace alglib_impl {
struct mlpbuffers {
ae_int_t chunksize;
ae_int_t ntotal;
ae_int_t nin;
ae_int_t nout;
ae_int_t wcount;
ae_vector batch4buf;
ae_vector hpcbuf;
ae_matrix xy;
ae_matrix xy2;
ae_vector xyrow;
ae_vector x;
ae_vector y;
ae_vector desiredy;
double e;
ae_vector g;
ae_vector tmp0;
};
void mlpbuffers_init(void *_p, bool make_automatic);
void mlpbuffers_copy(void *_dst, const void *_src, bool make_automatic);
void mlpbuffers_free(void *_p, bool make_automatic);
void hpcpreparechunkedgradient(RVector *weights, ae_int_t wcount, ae_int_t ntotal, ae_int_t nin, ae_int_t nout, mlpbuffers *buf);
void hpcfinalizechunkedgradient(mlpbuffers *buf, RVector *grad);
bool hpcchunkedgradient(RVector *weights, ZVector *structinfo, RVector *columnmeans, RVector *columnsigmas, RMatrix *xy, ae_int_t cstart, ae_int_t csize, RVector *batch4buf, RVector *hpcbuf, double *e, bool naturalerrorfunc);
bool hpcchunkedprocess(RVector *weights, ZVector *structinfo, RVector *columnmeans, RVector *columnsigmas, RMatrix *xy, ae_int_t cstart, ae_int_t csize, RVector *batch4buf, RVector *hpcbuf);
} // end of namespace alglib_impl
#endif // OnceOnly