-
Notifications
You must be signed in to change notification settings - Fork 1
/
ccmath.h
914 lines (465 loc) · 20.6 KB
/
ccmath.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
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
/* ccmath.h CCMATH mathematics library source code.
*
* Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
* This code may be redistributed under the terms of the GNU library
* public license (LGPL). ( See the lgpl.license file for details.)
* ------------------------------------------------------------------------
*/
/*
CCM
Numerical Analysis Toolkit Header File
ELF Shared Library Version
*/
/* Required for Shared Library */
#define XMATH 1
/* Define File Pointers and Standard Library */
#include <stdio.h>
#include <stdlib.h>
/* Definitions of Types */
#ifndef NULL
#define NULL ((void *)0
#endif
/* Complex Types */
#ifndef CPX
struct complex {double re,im;};
typedef struct complex Cpx;
#define CPX 1
#endif
/* Orthogonal Polynomial Type */
#ifndef OPOL
struct orpol {double cf,hs,df;};
typedef struct orpol Opol;
#define OPOL 1
#endif
/* Tree Types */
#ifdef BAL
struct tnode {char *key,*rec; int bal; struct tnode *pr,*pl;};
#else
struct tnode {char *key,*rec; struct tnode *pr,*pl;};
#endif
/* Time Series Types */
struct mcof {double cf; int lag;};
struct fmod {int fac; double val;};
/* List Definition */
struct llst {char *pls; struct llst *pt;};
/* Hash Table Definition */
struct tabl {char *key,*val; struct tabl *pt;};
/* Extended Precision Types */
/* XMATH must be defined to use extended precision functions */
#ifdef XMATH
#ifndef XPR
#define XDIM 7
struct xpr {unsigned short nmm[XDIM+1];};
extern unsigned short m_sgn,m_exp;
extern short bias;
extern int itt_div,k_tanh;
extern int ms_exp,ms_trg,ms_hyp;
extern short max_p,k_lin;
extern short d_bias,d_max,d_lex;
extern struct xpr zero,one,two,ten;
extern struct xpr x_huge;
/* Variables used in extended precision arithmetic */
unsigned short m_sgn=0x8000,m_exp=0x7fff;
short bias=16383;
int itt_div=2,k_tanh=5;
int ms_exp=21,ms_hyp=25,ms_trg=31;
short max_p=16*XDIM,k_lin= -8*XDIM;
short d_bias=15360,d_max=2047,d_lex=12;
struct xpr zero={{0x0,0x0}};
struct xpr one={{0x3fff,0x8000}};
struct xpr two={{0x4000,0x8000}};
struct xpr ten={{0x4002,0xa000}};
struct xpr x_huge={{0x7fff,0x0}};
/* Variables used in the extended precision math functions */
struct xpr pi4={{0x3FFE,0xC90F,0xDAA2,0x2168,0xC234,0xC4C6,0x628B,0x80DC}};
struct xpr pi2={{0x3FFF,0xC90F,0xDAA2,0x2168,0xC234,0xC4C6,0x628B,0x80DC}};
struct xpr pi={{0x4000,0xC90F,0xDAA2,0x2168,0xC234,0xC4C6,0x628B,0x80DC}};
struct xpr ee={{0x4000,0xADF8,0x5458,0xA2BB,0x4A9A,0xAFDC,0x5620,0x273D}};
struct xpr ln2={{0x3FFE,0xB172,0x17F7,0xD1CF,0x79AB,0xC9E3,0xB398,0x3F3}};
struct xpr srt2={{0x3FFF,0xB504,0xF333,0xF9DE,0x6484,0x597D,0x89B3,0x754B}};
#define XPR 1
#endif
#endif
/* FUNCTION DECLARATIONS */
/* Linear Algebra */
/* Real Linear Systems */
int minv(double *a,int n) ;
int psinv(double *v,int n) ;
int ruinv(double *a,int n) ;
int solv(double *a,double *b,int n) ;
int solvps(double *s,double *x,int n) ;
int solvru(double *a,double *b,int n) ;
void solvtd(double *a,double *b,double *c,double *x,int m) ;
void eigen(double *a,double *eval,int n) ;
void eigval(double *a,double *eval,int n) ;
double evmax(double *a,double *u,int n) ;
int svdval(double *d,double *a,int m,int n) ;
int sv2val(double *d,double *a,int m,int n) ;
int svduv(double *d,double *a,double *u,int m,double *v,int n) ;
int sv2uv(double *d,double *a,double *u,int m,double *v,int n) ;
int svdu1v(double *d,double *a,int m,double *v,int n) ;
int sv2u1v(double *d,double *a,int m,double *v,int n) ;
void mmul(double *mat,double *a,double *b,int n) ;
void rmmult(double *mat,double *a,double *b,int m,int k,int n) ;
void vmul(double *vp,double *mat,double *v,int n) ;
double vnrm(double *u,double *v,int n) ;
void matprt(double *a,int n,int m,char *fmt) ;
void fmatprt(FILE *fp,double *a,int n,int m,char *fmt) ;
void trnm(double *a,int n) ;
void mattr(double *a,double *b,int m,int n) ;
void otrma(double *at,double *u,double *a,int n) ;
void otrsm(double *st,double *u,double *s0,int n) ;
void mcopy(double *a,double *b,int m) ;
void ortho(double *evc,int n) ;
void smgen(double *a,double *eval,double *evec,int n) ;
/* utility routines for real symmertic eigensystems */
void house(double *a,double *d,double *ud,int n) ;
void housev(double *a,double *d,double *ud,int n) ;
int qreval(double *eval,double *ud,int n) ;
int qrevec(double *eval,double *evec,double *dp,int n) ;
/* utility routines for singular value decomposition */
int qrbdi(double *d, double *e,int n) ;
int qrbdv(double *d, double *e,double *u,int m,double *v,int n) ;
int qrbdu1(double *d, double *e,double *u,int m,double *v,int n) ;
void ldumat(double *a,double *u,int m,int n) ;
void ldvmat(double *a,double *v,int n) ;
void atou1(double *a,int m,int n) ;
void atovm(double *v,int n) ;
/* Complex Matrix Algebra */
int cminv(Cpx *a,int n) ;
int csolv(Cpx *a,Cpx *b,int n) ;
void heigvec(Cpx *a,double *eval,int n) ;
void heigval(Cpx *a,double *eval,int n) ;
double hevmax(Cpx *a,Cpx *u,int n) ;
void cmmul(Cpx *c,Cpx *a,Cpx *b,int n) ;
void cmmult(Cpx *c,Cpx *a,Cpx *b,int m,int k,int n) ;
void cvmul(Cpx *vp,Cpx *mat,Cpx *v,int n) ;
Cpx cvnrm(Cpx *u,Cpx *v,int n) ;
void cmprt(Cpx *a,int n,int m,char *fmt) ;
void trncm(Cpx *a,int n) ;
void hconj(Cpx *u,int n) ;
void cmattr(Cpx *a,Cpx *b,int m,int n) ;
void utrncm(Cpx *at,Cpx *u,Cpx *a,int n) ;
void utrnhm(Cpx *ht,Cpx *u,Cpx *h0,int n) ;
void cmcpy(Cpx *a,Cpx *b,int n) ;
void unitary(Cpx *u,int n) ;
void hmgen(Cpx *h,double *eval,Cpx *u,int n) ;
/* utility routines for hermitian eigen problems */
void chouse(Cpx *a,double *d,double *ud,int n) ;
void chousv(Cpx *a,double *d,double *ud,int n) ;
void qrecvc(double *eval,Cpx *evec,double *ud,int n) ;
/* Geometry */
void crossp(double *h,double *u,double *v) ;
double dotp(double *u,double *v,int m) ;
double metpr(double *u,double *a,double *v,int n) ;
void scalv(double *r,double s,int n) ;
void trvec(double *c,double *a,double *b,int n) ;
double leng(double *a,double *b,int n) ;
void rotax(double *v,double az,double pa,double ang,int k) ;
void euler(double *pv,int m,double a,double b,double c) ;
/* plane trigonometry */
void trgsas(double a,double g,double b,double *ans);
int trgasa(double a,double ss,double b,double *asn);
double trgarea(double a,double b,double c);
int trgsss(double a,double b,double c,double *ang);
int trgssa(double a,double b,double ba,double *an);
/* spherical trigonometry */
void stgsas(double a,double g,double b,double *ang);
int stgasa(double a,double c,double b,double *ang);
int stgsss(double a,double b,double c,double *ang);
int stgaaa(double a,double b,double c,double *ang);
double stgarea(double a,double b,double c);
/* hyperbolic trigonometry */
void htgsas(double a,double g,double b,double *an);
int htgasa(double a,double cc,double b,double *ans);
int htgsss(double a,double b,double c,double *ang);
int htgaaa(double a,double b,double c,double *as);
double htgarea(double a,double b,double c);
/* Numerical Integration */
double fintg(double a,double b,int n,double te,double (*func)()) ;
/* functional form: double (*func)(double) */
double chintg(double *a,int m,double (*func)()) ;
/* functional form: double (*func)(double) */
double fchb(double x,double *a,int m) ;
int deqsy(double *y,int n,double a,double b,int nd,double te,
int (*fsys)()) ;
/* functional form: int (*fsys)(double x,double *y,double *dp) */
/* Optimization and Roots */
int optmiz(double *x,int n,double (*func)(),double de,
double test,int max) ;
/* functional form: double (*func)(double *x) */
double optsch(double (*func)(),double a,double b,double test) ;
/* functional form: double (*func)(double) */
int plrt(double *cof,int n,struct complex *root,double ra,double rb) ;
struct complex polyc(struct complex z,double *cof,int n) ;
double secrt(double (*func)(),double x,double dx,double test) ;
/* functional form: double (*func)(double) */
int solnl(double *x,double *f,double (*fvec[])(),int n,double test) ;
/* functional form: double (*fvec[])(double *x) */
int solnx(double *x,double *f,double (*fvec[])(),double *jm,
int n,double test) ;
/* functional form: double (*fvec[])(double *x) */
/* Curve Fitting and Least Squares */
void chcof(double *c,int m,double (*func)()) ;
/* functional form: double (*func)(double) */
void chpade(double *c,double *a,int m,double *b,int n) ;
double ftch(double x,double *a,int m,double *b,int n) ;
void cspl(double *x,double *y,double *z,int m,double tn) ;
void csplp(double *x,double *y,double *z,int m,double tn) ;
double csfit(double w,double *x,double *y,double *z,int m) ;
double tnsfit(double w,double *x,double *y,double *z,
int m,double tn) ;
double dcspl(double x,double *u,double *v,double *z,int m) ;
/* polynominal least squares functions use the Opol structure. */
void plsq(double *x,double *y,int n,Opol *c,double *ssq,int m) ;
double pplsq(double *x,double *y,int n,double *b,int m) ;
double evpsq(double x,Opol *c,int m) ;
double evpsqv(double x, Opol *c,int m,double *sig,double sqv) ;
void psqcf(double *pc,Opol *c,int m) ;
void psqvar(double *var,double s,Opol *c,int m) ;
/* QR transformation for linear least squares. */
double qrlsq(double *a,double *b,int m,int n,int *f) ;
double qrvar(double *v,int m,int n,double ssq) ;
/* singular value decomposition least squares. */
double lsqsv(double *x,int *pr,double *var,double *d,double *b,
double *v,int m,int n,double th) ;
int svdlsq(double *d,double *a,double *b,int m,double *v,int n) ;
int sv2lsq(double *d,double *a,double *b,int m,double *v,int n) ;
/* utility called by svdlsq and sv2lsq. */
int qrbdbv(double *d,double *e,double *b,double *v,int n) ;
/* nonlinear least squares */
double seqlsq(double *x,double *y,int n,double *par,double *var,
int m,double de,double (*func)(),int kf) ;
/* functional form: double (*func)(double x,double *par) */
double gnlsq(double *x,double *y,int n,double *par,
double *var,int m,double de,double (*func)()) ;
/* functional form: double (*func)(double x,double *par) */
double fitval(double x,double *s,double *par,double (*fun)(),
double *v,int n) ;
/* functional form: double (*func)(double x,double *par) */
void setfval(int i,int n) ;
/* Fourier Analysis */
void fft2(struct complex *ft,int m,int inv) ;
void fft2_d(struct complex *a,int m,int n,int f) ;
void fftgc(struct complex **pc,struct complex *ft,int n,
int *kk,int inv) ;
void fftgr(double *x,struct complex *ft,int n,int *kk,int inv) ;
void ftuns(struct complex **pt,int n) ;
int pfac(int n,int *kk,int fe) ;
void pshuf(Cpx **pa,Cpx **pb,int *kk,int n) ;
int pwspec(double *x,int n,int m) ;
void smoo(double *x,int n,int m) ;
/* Simulation Support */
double *autcor(double *x,int n,int lag) ;
int *hist(double *x,int n,double xmin,double xmax,
int kbin,double *bin) ;
unsigned int lran1() ;
void setlran1(unsigned int seed) ;
unsigned int lrand() ;
void setlrand(unsigned int seed) ;
int bran(int n) ;
void setbran(unsigned int seed) ;
int bran2(int n) ;
void setbran2(unsigned int seed) ;
double unfl() ;
void setunfl(unsigned int seed) ;
double unfl2() ;
void setunfl2(unsigned int seed) ;
double nrml() ;
void setnrml(unsigned int seed) ;
void norm(double *err) ;
void setnorm(unsigned int seed) ;
void norm2(double *err) ;
void setnorm2(unsigned int seed) ;
void sampl(void **s,int n,void **d,int m) ;
void shuffl(void **s,int n) ;
/* utility routines used for 2^31 - 1 modular arithmetic */
unsigned int lrana(unsigned int s) ;
unsigned int lranb(unsigned int s) ;
/* Sorts and Searches */
int batdel(char *kin,struct tnode *hd) ;
struct tnode *batins(char *kin,struct tnode *hd) ;
struct tnode *btsearch(char *kin,struct tnode *hd) ;
void btsort(struct tnode *hd,struct tnode **ar) ;
void prbtree(struct tnode *hd,int m) ;
int btdel(char *kin,struct tnode *hd) ;
struct tnode *btins(char *kin,struct tnode *hd) ;
struct tnode *tsearch(char *kin,struct tnode *hd) ;
void tsort(struct tnode *hd,struct tnode **ar) ;
void prtree(struct tnode *hd,int m) ;
int hashdel(char *kin,struct tabl *harr[],int mh) ;
struct tabl *hashins(char *kin,struct tabl *harr[],int mh) ;
struct tabl *hfind(char *kin,struct tabl *harr[],int mh) ;
int hval(char *key,int mh) ;
struct llst *msort(struct llst *st,int dim,int (*comp)()) ;
void qsrt(void *v,int i,int j,int (*comp)()) ;
void hsort(void *v,int n,int (*comp)()) ;
void ssort(void *v,int n,int (*comp)()) ;
/* comparison functions for sort routines. */
/* define the functional form of int (*comp)() */
int dubcmp(double *x,double *y) ;
int intcmp(int *x,int *y) ;
int unicmp(unsigned *x,unsigned *y) ;
/* the standard library function strcmp will also work
with these sorts */
/* Statistical Distributions */
double qnorm(double x) ;
double pctn(double pc) ;
double qgama(double x,double a) ;
double pctg(double pc,double a) ;
double qbeta(double x,double a,double b) ;
double pctb(double pc,double a,double b) ;
double qgnc(double x,double a,double d) ;
double pctgn(double pc,double a,double d) ;
double qbnc(double x,double a,double b,double d) ;
double pctbn(double pc,double a,double b,double d) ;
/* Special Functions */
/* elliptic integrals and functions */
double nome(double k,double *pk,double *pkp) ;
double amelp(double u,double k) ;
double theta(double u,int n) ;
void stheta(double k) ;
double felp(double an,double k,double *pk,double *pz,double *ph) ;
double gelp(double an,double k,double as,double bs,
double ds,double *pg,double *pf,double *pk) ;
double g2elp(double an,double bn,double k,double as,
double bs,double ds) ;
/* bessel functions */
double jbes(double v,double x) ;
double ibes(double v,double x) ;
double kbes(double v,double x) ;
double nbes(double v,double x) ;
double drbes(double x,double v,int f,double *p) ;
double rcbes() ;
void setrcb(double u,double y,int fl,int dr,double *pf,
double *ph) ;
/* spherical bessel functions */
double jspbes(int n,double x) ;
double kspbes(int n,double x) ;
double yspbes(int n,double x) ;
double drspbes(double x,int n,int f,double *p) ;
double rcspbs() ;
void setrcsb(int n,double y,int fl,int dr,double *pf,double *ph) ;
/* airy functions */
double airy(double x,int df) ;
double biry(double x,int df) ;
/* gamma and related functions */
double gaml(double x) ;
double psi(int m) ;
double psih(double v) ;
/* support routines for evaluation of elliptic integrals */
double gsng(double *pa,double *pb,double *pc,double b,double an) ;
double gsng2(double *pa,double *pb,double *pc,double b,
double an,double bn) ;
/* Complex Arithmetic */
struct complex cmul(struct complex s,struct complex t) ;
struct complex cdiv(struct complex s,struct complex t) ;
struct complex cadd(struct complex s,struct complex t) ;
struct complex csub(struct complex s,struct complex t) ;
struct complex crmu(double a,struct complex z) ;
struct complex cimu(double b,struct complex z) ;
struct complex ccng(struct complex z) ;
struct complex cdef(double r,double i) ;
double cabs(struct complex c) ;
double cnrm(struct complex z) ;
struct complex cexp(struct complex z) ;
struct complex clog(struct complex z) ;
struct complex csinh(struct complex z) ;
struct complex ccosh(struct complex z) ;
struct complex ctanh(struct complex z) ;
struct complex casinh(struct complex z) ;
struct complex cacosh(struct complex z) ;
struct complex catanh(struct complex z) ;
struct complex casin(struct complex z) ;
struct complex cacos(struct complex z) ;
struct complex catan(struct complex z) ;
struct complex csqrt(struct complex z) ;
struct complex csin(struct complex z) ;
struct complex ccos(struct complex z) ;
struct complex ctan(struct complex z) ;
/* Time Series */
double sarma(double er) ;
void setsim(int k) ;
double parma(double *x,double *e) ;
double evfmod(struct fmod y) ;
void setevf(int k) ;
double drfmod(struct fmod y,double *dr) ;
void setdrf(int k) ;
double seqtsf(struct fmod *x,int n,double *var,int kf) ;
double fixtsf(struct fmod *x,int n,double *var,double *cr) ;
double evmod(double y) ;
void setev(int k) ;
double drmod(double y,double *dr) ;
void setdr(int k) ;
double seqts(double *x,int n,double *var,int kf) ;
double fixts(double *x,int n,double *var,double *cr) ;
int resid(double *x,int n,int lag,double **pau,int nbin,
double xa,double xb,int **phs,int *cks) ;
int sany(double *x,int n,double *pm,double *cd,double *ci,
int nd,int ms,int lag) ;
double sdiff(double y,int nd,int k) ;
double sintg(double y,int nd,int k) ;
double xmean(double *x,int n) ;
/* Extended Precision Arithmetic */
/* XMATH must be defined to use these functions */
#ifdef XMATH
struct xpr xadd(struct xpr s,struct xpr t,int f) ;
struct xpr xmul(struct xpr s,struct xpr t) ;
struct xpr xdiv(struct xpr s,struct xpr t) ;
double xtodub(struct xpr s) ;
struct xpr dubtox(double y) ;
struct xpr inttox(int n) ;
int xprcmp(struct xpr *pa,struct xpr *pb) ;
struct xpr xneg(struct xpr s) ;
struct xpr xabs(struct xpr s) ;
int xex(struct xpr *ps) ;
int neg(struct xpr *ps) ;
struct xpr xfrex(struct xpr s,int *p) ;
struct xpr xfmod(struct xpr s,struct xpr t,int *p) ;
struct xpr xsqrt(struct xpr z) ;
struct xpr xexp(struct xpr z) ;
struct xpr xlog(struct xpr z) ;
struct xpr xpwr(struct xpr s,int n) ;
struct xpr xpr2(struct xpr s,int m) ;
struct xpr xtan(struct xpr z) ;
struct xpr xcos(struct xpr z) ;
struct xpr xsin(struct xpr z) ;
struct xpr xatan(struct xpr z) ;
struct xpr xasin(struct xpr z) ;
struct xpr xacos(struct xpr z) ;
struct xpr xtanh(struct xpr z) ;
struct xpr xsinh(struct xpr z) ;
struct xpr xcosh(struct xpr z) ;
struct xpr atox(char *s) ;
void prxpr(struct xpr u,int lim) ;
void xprint(struct xpr x) ;
/* special applications */
void xchcof(struct xpr *cf,int m,struct xpr (*xfunc)()) ;
/* functional form: xpr (*xfunc)(xpr *cf) */
struct xpr xevtch(struct xpr z,struct xpr *a,int m) ;
/* utility operations on extended precision numbers */
struct xpr sfmod(struct xpr s,int *p) ;
void lshift(int n,unsigned short *pm,int m) ;
void rshift(int n,unsigned short *pm,int m) ;
#endif
/* Utility Operations (on Bits) */
unsigned short bset(unsigned short x,unsigned short n) ;
int bget(unsigned short x,unsigned short n) ;
int bcnt(unsigned short x) ;
unsigned int lbset(unsigned int x,int n) ;
int lbget(unsigned int x,int n) ;
int lbcnt(unsigned int x) ;
void bitpc(unsigned char x) ;
void bitps(unsigned short x) ;
void bitpl(unsigned int x) ;
void bitpf(float x);
void bitpd(double x) ;
#ifdef XMATH
void bpatx(struct xpr x) ;
#endif
double pwr(double y,int n) ;
/*
special declarations required for shared library
*/
int np,nma,nar,nfc,ndif;
struct mcof *par,*pma,*pfc;