home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / optivc32 / vcemath.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-03-06  |  16.2 KB  |  375 lines

  1. /*  VCEmath.h
  2.  
  3.   vector management functions:
  4.   math functions performed on each individual element of an
  5.   array or vector of data type "eComplex" (complex long double)
  6.  
  7.   Copyright (c) 1996-1999 by Martin Sander
  8.   All Rights Reserved.
  9. */
  10.  
  11. #ifndef __VCEMATH_H
  12. #define __VCEMATH_H
  13.  
  14. #ifndef __VCESTD_H 
  15. #include <VCEstd.h>
  16. #endif
  17.  
  18.  
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22.  
  23. #ifdef __BORLANDC__   /* 80-bit IEEE numbers supported.
  24.                          The following  200 lines apply 
  25.                          only to Borland C++            */
  26.  
  27.     /************************ Comparisons ********************************/
  28.  
  29. ui   __vf   VCE_cmp_eq0( ceVector Y, ceVector X, ui size );
  30. ui   __vf   VCE_cmp_ne0( ceVector Y, ceVector X, ui size );
  31. ui   __vf   VCE_cmp_eqC( ceVector Y, ceVector X, ui size,
  32.                          eComplex C );
  33. ui   __vf   VCE_cmp_neC( ceVector Y, ceVector X, ui size,
  34.                          eComplex C );
  35. ui   __vf   VCE_cmp_eqV( ceVector Z, ceVector X, ceVector Y, ui size );
  36. ui   __vf   VCE_cmp_neV( ceVector Z, ceVector X, ceVector Y, ui size );
  37. ui   __vf   VCE_cmp_eq0ind( uiVector Ind, ceVector X, ui size );
  38. ui   __vf   VCE_cmp_ne0ind( uiVector Ind, ceVector X, ui size );
  39. ui   __vf   VCE_cmp_eqCind( uiVector Ind, ceVector X, ui size,
  40.                             eComplex C );
  41. ui   __vf   VCE_cmp_neCind( uiVector Ind, ceVector X, ui size,
  42.                             eComplex C );
  43. ui   __vf   VCE_cmp_eqVind( uiVector Ind, ceVector X, ceVector Y, ui size );
  44. ui   __vf   VCE_cmp_neVind( uiVector Ind, ceVector X, ceVector Y, ui size );
  45.  
  46.  
  47. /********************  Standard Arithmetics   ***************************/
  48.  
  49. void  __vf   VCE_limit(  ceVector Y, ceVector X, ui size, eComplex Min,
  50.                                                           eComplex Max );
  51. void  __vf   VCE_flush0( ceVector Y, ceVector X, ui size, eComplex AbsMin );
  52. void  __vf   VCE_flushInv( ceVector Y, ceVector X, ui size, eComplex AbsMin );
  53.  
  54. void  __vf   VCEx_equV( ceVector Y, ceVector X, ui size,
  55.                         eComplex A, eComplex B );
  56. void  __vf   VCE_addC(  ceVector Y, ceVector X, ui size, eComplex C );
  57. void  __vf   VCE_subC(  ceVector Y, ceVector X, ui size, eComplex C );
  58. void  __vf   VCE_subrC( ceVector Y, ceVector X, ui size, eComplex C );
  59. void  __vf   VCE_mulC(  ceVector Y, ceVector X, ui size, eComplex C );
  60. void  __vf   VCE_divC(  ceVector Y, ceVector X, ui size, eComplex C );
  61. void  __vf   VCE_divrC( ceVector Y, ceVector X, ui size, eComplex C );
  62. void  __vf   VCEx_divrC( ceVector Y, ceVector X, ui size,
  63.                          eComplex A, eComplex B, eComplex C );
  64.  
  65. void  __vf   VCE_addReC(  ceVector Y, ceVector X, ui size, long double CRe );
  66. void  __vf   VCE_subReC(  ceVector Y, ceVector X, ui size, long double CRe );
  67. void  __vf   VCE_subrReC( ceVector Y, ceVector X, ui size, long double CRe );
  68. void  __vf   VCE_mulReC(  ceVector Y, ceVector X, ui size, long double CRe );
  69. void  __vf   VCE_divReC(  ceVector Y, ceVector X, ui size, long double CRe );
  70. void  __vf   VCE_divrReC( ceVector Y, ceVector X, ui size, long double CRe );
  71.  
  72. void  __vf   VCE_addV(  ceVector Z, ceVector X, ceVector Y, ui size );
  73. void  __vf   VCE_subV(  ceVector Z, ceVector X, ceVector Y, ui size );
  74. void  __vf   VCE_subrV( ceVector Z, ceVector X, ceVector Y, ui size );
  75. void  __vf   VCE_mulV(  ceVector Z, ceVector X, ceVector Y, ui size );
  76. void  __vf   VCE_divV(  ceVector Z, ceVector X, ceVector Y, ui size );
  77. void  __vf   VCE_divrV( ceVector Z, ceVector X, ceVector Y, ui size );
  78.  
  79. void  __vf   VCE_addReV(  ceVector Z, ceVector X, eVector Y, ui size );
  80. void  __vf   VCE_subReV(  ceVector Z, ceVector X, eVector Y, ui size );
  81. void  __vf   VCE_subrReV( ceVector Z, ceVector X, eVector Y, ui size );
  82. void  __vf   VCE_mulReV(  ceVector Z, ceVector X, eVector Y, ui size );
  83. void  __vf   VCE_divReV(  ceVector Z, ceVector X, eVector Y, ui size );
  84. void  __vf   VCE_divrReV( ceVector Z, ceVector X, eVector Y, ui size );
  85.  
  86. void  __vf   VCEx_addV(  ceVector Z, ceVector X, ceVector Y, ui size,
  87.                          eComplex A, eComplex B );
  88. void  __vf   VCEx_subV(  ceVector Z, ceVector X, ceVector Y, ui size,
  89.                          eComplex A, eComplex B );
  90. void  __vf   VCEx_subrV( ceVector Z, ceVector X, ceVector Y, ui size,
  91.                          eComplex A, eComplex B );
  92. void  __vf   VCEx_mulV(  ceVector Z, ceVector X, ceVector Y, ui size,
  93.                          eComplex A, eComplex B );
  94. void  __vf   VCEx_divV(  ceVector Z, ceVector X, ceVector Y, ui size,
  95.                          eComplex A, eComplex B );
  96. void  __vf   VCEx_divrV( ceVector Z, ceVector X, ceVector Y, ui size,
  97.                          eComplex A, eComplex B );
  98.  
  99. void  __vf   VCEx_addReV(  ceVector Z, ceVector X, eVector Y, ui size,
  100.                            eComplex A, eComplex B );
  101. void  __vf   VCEx_subReV(  ceVector Z, ceVector X, eVector Y, ui size,
  102.                            eComplex A, eComplex B );
  103. void  __vf   VCEx_subrReV( ceVector Z, ceVector X, eVector Y, ui size,
  104.                            eComplex A, eComplex B );
  105. void  __vf   VCEx_mulReV(  ceVector Z, ceVector X, eVector Y, ui size,
  106.                            eComplex A, eComplex B );
  107. void  __vf   VCEx_divReV(  ceVector Z, ceVector X, eVector Y, ui size,
  108.                            eComplex A, eComplex B );
  109. void  __vf   VCEx_divrReV( ceVector Z, ceVector X, eVector Y, ui size,
  110.                            eComplex A, eComplex B );
  111.  
  112. void  __vf   VCE_lincomb( ceVector Z, ceVector X, ceVector Y, ui size,
  113.                           eComplex CX, eComplex CY );  /* Z[i]=CX*X[i]+CY*Y[i] */
  114.  
  115. /******************** Accumulation (Y += X) ******************************/
  116.  
  117. void __vf VCE_accV(   ceVector Y, ceVector  X, ui size );
  118. void __vf VCE_accVCF( ceVector Y, cfVector  X, ui size );
  119. void __vf VCE_accVCD( ceVector Y, cdVector  X, ui size );
  120.  
  121.  
  122. /***************** Functions of a sub-set of elements  ********************/
  123.  
  124. void  __vf  VCE_subvector_equC(  ceVector Y, ui subsiz, unsigned samp,
  125.                                  eComplex C );
  126. void  __vf  VCE_subvector_equV(  ceVector Y, ui subsiz, unsigned samp,
  127.                                  ceVector X );
  128.  
  129. void  __vf  VCE_subvector_addC(  ceVector Y, ui subsiz, unsigned samp,
  130.                                  eComplex C );
  131. void  __vf  VCE_subvector_subC(  ceVector Y, ui subsiz, unsigned samp,
  132.                                  eComplex C );
  133. void  __vf  VCE_subvector_subrC( ceVector Y, ui subsiz, unsigned samp,
  134.                                  eComplex C );
  135. void  __vf  VCE_subvector_mulC(  ceVector Y, ui subsiz, unsigned samp,
  136.                                  eComplex C );
  137. void  __vf  VCE_subvector_divC(  ceVector Y, ui subsiz, unsigned samp,
  138.                                  eComplex C );
  139. void  __vf  VCE_subvector_divrC( ceVector Y, ui subsiz, unsigned samp,
  140.                                  eComplex C );
  141.  
  142. void  __vf  VCE_subvector_addV(  ceVector Y, ui subsiz, unsigned samp,
  143.                                  ceVector X );
  144. void  __vf  VCE_subvector_subV(  ceVector Y, ui subsiz, unsigned samp,
  145.                                  ceVector X );
  146. void  __vf  VCE_subvector_subrV( ceVector Y, ui subsiz, unsigned samp,
  147.                                  ceVector X );
  148. void  __vf  VCE_subvector_mulV(  ceVector Y, ui subsiz, unsigned samp,
  149.                                  ceVector X );
  150. void  __vf  VCE_subvector_divV(  ceVector Y, ui subsiz, unsigned samp,
  151.                                  ceVector X );
  152. void  __vf  VCE_subvector_divrV( ceVector Y, ui subsiz, unsigned samp,
  153.                                  ceVector X );
  154.  
  155.  
  156. /*******************  Mathematical Functions *************************/
  157.  
  158. int   __vf   VCE_neg(  ceVector Y, ceVector X, ui size );
  159. int   __vf   VCE_conj( ceVector Y, ceVector X, ui size );
  160. int   __vf   VCE_abs(   eVector Y, ceVector X, ui size );
  161. int   __vf   VCE_inv(  ceVector Y, ceVector X, ui size );
  162. int   __vf   VCEx_inv( ceVector Y, ceVector X, ui size,
  163.                        eComplex A, eComplex B );
  164.  
  165. int  __vf   VCE_square(  ceVector Y, ceVector X, ui size );
  166. int  __vf   VCEx_square( ceVector Y, ceVector X, ui size,
  167.                          eComplex A, eComplex B );
  168. int  __vf   VCE_cubic(   ceVector Y, ceVector X, ui size );
  169. int  __vf   VCEx_cubic(  ceVector Y, ceVector X, ui size,
  170.                          eComplex A, eComplex B );
  171. int  __vf   VCE_quartic( ceVector Y, ceVector X, ui size );
  172. int  __vf   VCEx_quartic( ceVector Y, ceVector X, ui size,
  173.                          eComplex A, eComplex B );
  174. int  __vf   VCE_ipow( ceVector Y, ceVector X, ui size, int ipow );
  175. int  __vf   VCEx_ipow( ceVector Y, ceVector X, ui size, int ipow,
  176.                        eComplex A, eComplex B, eComplex C );
  177. int  __vf   VCE_pow( ceVector Y, ceVector X, ui size, eComplex Expo );
  178. int  __vf   VCEx_pow( ceVector Y, ceVector X, ui size,  eComplex Expo,
  179.                       eComplex A, eComplex B, eComplex C );
  180. int  __vf   VCE_powReExpo(  ceVector Y, ceVector X, ui size, extended Expo );
  181. int  __vf   VCEx_powReExpo( ceVector Y, ceVector X, ui size, extended Expo,
  182.                             eComplex A, eComplex B, eComplex C );
  183.  
  184. int  __vf   VCE_sqrt( ceVector Y, ceVector X, ui size );
  185. int  __vf   VCEx_sqrt( ceVector Y, ceVector X, ui size,
  186.                        eComplex A, eComplex B, eComplex C );
  187.  
  188. int  __vf   VCE_log( ceVector Y, ceVector X, ui size );
  189. int  __vf   VCE_log2( ceVector Y, ceVector X, ui size );
  190. int  __vf   VCE_log10( ceVector Y, ceVector X, ui size );
  191. #define     VCE_ln  VCE_log
  192. int  __vf   VCEx_log( ceVector Y, ceVector X, ui size,
  193.                       eComplex A, eComplex B, eComplex C );
  194. int  __vf   VCEx_log2( ceVector Y, ceVector X, ui size,
  195.                        eComplex A, eComplex B, eComplex C );
  196. int  __vf   VCEx_log10( ceVector Y, ceVector X, ui size,
  197.                         eComplex A, eComplex B, eComplex C );
  198. #define     VCEx_ln    VCEx_log
  199.  
  200. int  __vf   VCE_exp( ceVector Y, ceVector X, ui size );
  201. int  __vf   VCEx_exp( ceVector Y, ceVector X, ui size,
  202.                       eComplex A, eComplex B, eComplex C );
  203. int  __vf   VCE_expArbBase(  ceVector Y, ceVector X, ui size, eComplex Base );
  204. int  __vf   VCEx_expArbBase( ceVector Y, ceVector X, ui size, eComplex Base,
  205.                              eComplex A, eComplex B, eComplex C );
  206.  
  207. int  __vf   VCE_sin( ceVector Y, ceVector X, ui size );
  208. int  __vf   VCEx_sin( ceVector Y, ceVector X, ui size,
  209.                       eComplex A, eComplex B, eComplex C );
  210. int  __vf   VCE_cos( ceVector Y, ceVector X, ui size );
  211. int  __vf   VCEx_cos( ceVector Y, ceVector X, ui size,
  212.                       eComplex A, eComplex B, eComplex C );
  213. int  __vf   VCE_tan( ceVector Y, ceVector X, ui size );
  214. int  __vf   VCEx_tan( ceVector Y, ceVector X, ui size,
  215.                       eComplex A, eComplex B, eComplex C );
  216.  
  217. int  __vf   VCE_asin( ceVector Y, ceVector X, ui size );
  218. int  __vf   VCEx_asin( ceVector Y, ceVector X, ui size,
  219.                        eComplex A, eComplex B, eComplex C );
  220. int  __vf   VCE_acos( ceVector Y, ceVector X, ui size );
  221. int  __vf   VCEx_acos( ceVector Y, ceVector X, ui size,
  222.                        eComplex A, eComplex B, eComplex C );
  223. int  __vf   VCE_atan( ceVector Y, ceVector X, ui size );
  224. int  __vf   VCEx_atan( ceVector Y, ceVector X, ui size,
  225.                        eComplex A, eComplex B, eComplex C );
  226.  
  227. int  __vf   VCE_sinh( ceVector Y, ceVector X, ui size );
  228. int  __vf   VCEx_sinh( ceVector Y, ceVector X, ui size,
  229.                        eComplex A, eComplex B, eComplex C );
  230. int  __vf   VCE_cosh( ceVector Y, ceVector X, ui size );
  231. int  __vf   VCEx_cosh( ceVector Y, ceVector X, ui size,
  232.                        eComplex A, eComplex B, eComplex C );
  233. int  __vf   VCE_tanh( ceVector Y, ceVector X, ui size );
  234. int  __vf   VCEx_tanh( ceVector Y, ceVector X, ui size,
  235.                        eComplex A, eComplex B, eComplex C );
  236.  
  237.  
  238. #else   /* no 80-bit IEEE number support with Visual C++:
  239.            the following 120 lines apply only to Visual C++  */
  240.  
  241. #define VCE_cmp_eq0     VCD_cmp_eq0
  242. #define VCE_cmp_ne0     VCD_cmp_ne0
  243. #define VCE_cmp_eqC     VCD_cmp_eqC
  244. #define VCE_cmp_neC     VCD_cmp_neC
  245. #define VCE_cmp_eqV     VCD_cmp_eqV
  246. #define VCE_cmp_neV     VCD_cmp_neV
  247. #define VCE_cmp_eq0ind  VCD_cmp_eq0ind
  248. #define VCE_cmp_ne0ind  VCD_cmp_ne0ind
  249. #define VCE_cmp_eqCind  VCD_cmp_eqCind
  250. #define VCE_cmp_neCind  VCD_cmp_neCind
  251. #define VCE_cmp_eqVind  VCD_cmp_eqVind
  252. #define VCE_cmp_neVind  VCD_cmp_neVind
  253.  
  254. #define VCE_limit       VCD_limit
  255. #define VCE_flush0      VCD_flush0
  256. #define VCEx_equV       VCDx_equV
  257. #define VCE_addC        VCD_addC
  258. #define VCE_subC        VCD_subC
  259. #define VCE_subrC       VCD_subrC
  260. #define VCE_mulC        VCD_mulC
  261. #define VCE_divC        VCD_divC
  262. #define VCE_divrC       VCD_divrC
  263. #define VCEx_divrC      VCDx_divrC
  264. #define VCE_addReC      VCD_addReC
  265. #define VCE_subReC      VCD_subReC
  266. #define VCE_subrReC     VCD_subrReC
  267. #define VCE_mulReC      VCD_mulReC
  268. #define VCE_divReC      VCD_divReC
  269. #define VCE_divrReC     VCD_divrReC
  270. #define VCE_addV        VCD_addV
  271. #define VCE_subV        VCD_subV
  272. #define VCE_subrV       VCD_subrV
  273. #define VCE_mulV        VCD_mulV
  274. #define VCE_divV        VCD_divV
  275. #define VCE_divrV       VCD_divrV
  276. #define VCE_addReV      VCD_addReV
  277. #define VCE_subReV      VCD_subReV
  278. #define VCE_subrReV     VCD_subrReV
  279. #define VCE_mulReV      VCD_mulReV
  280. #define VCE_divReV      VCD_divReV
  281. #define VCE_divrReV     VCD_divrReV
  282. #define VCEx_addV       VCDx_addV
  283. #define VCEx_subV       VCDx_subV
  284. #define VCEx_subrV      VCDx_subrV
  285. #define VCEx_mulV       VCDx_mulV
  286. #define VCEx_divV       VCDx_divV
  287. #define VCEx_divrV      VCDx_divrV
  288. #define VCEx_addReV     VCDx_addReV
  289. #define VCEx_subReV     VCDx_subReV
  290. #define VCEx_subrReV    VCDx_subrReV
  291. #define VCEx_mulReV     VCDx_mulReV
  292. #define VCEx_divReV     VCDx_divReV
  293. #define VCEx_divrReV    VCDx_divrReV
  294.  
  295. #define VCE_lincomb     VCD_lincomb
  296. #define VCE_accV        VCD_accV
  297. #define VCE_accVF       VCD_accVF
  298. #define VCE_accVD       VCD_accV
  299.  
  300. #define VCE_subvector_equC  VCD_subvector_equC
  301. #define VCE_subvector_addC  VCD_subvector_addC
  302. #define VCE_subvector_subC  VCD_subvector_subC
  303. #define VCE_subvector_subrC VCD_subvector_subrC
  304. #define VCE_subvector_mulC  VCD_subvector_mulC
  305. #define VCE_subvector_divC  VCD_subvector_divC
  306. #define VCE_subvector_divrC VCD_subvector_divrC
  307. #define VCE_subvector_addV  VCD_subvector_addV
  308. #define VCE_subvector_subV  VCD_subvector_subV
  309. #define VCE_subvector_subrV VCD_subvector_subrV
  310. #define VCE_subvector_mulV  VCD_subvector_mulV
  311. #define VCE_subvector_divV  VCD_subvector_divV
  312. #define VCE_subvector_divrV VCD_subvector_divrV
  313.  
  314. /*******************  Mathematical Functions *************************/
  315.  
  316. #define VCE_neg     VCD_neg
  317. #define VCE_conj    VCD_conj
  318. #define VCE_abs     VCD_abs
  319. #define VCE_inv     VCD_inv
  320. #define VCEx_inv    VCDx_inv
  321. #define VCE_square  VCD_square
  322. #define VCEx_square VCDx_square
  323. #define VCE_cubic   VCD_cubic
  324. #define VCEx_cubic  VCDx_cubic
  325. #define VCE_quartic VCD_quartic
  326. #define VCEx_quartic VCDx_quartic
  327. #define VCE_ipow    VCD_ipow
  328. #define VCEx_ipow   VCDx_ipow
  329. #define VCE_pow     VCD_pow
  330. #define VCEx_pow    VCDx_pow
  331. #define VCE_powReBase  VCD_powReBase
  332. #define VCE_powReExpo  VCD_powReExpo
  333. #define VCEx_powReExpo VCDx_powReExpo
  334. #define VCE_sqrt    VCD_sqrt
  335. #define VCEx_sqrt   VCDx_sqrt
  336. #define VCE_log     VCD_log
  337. #define VCEx_log    VCDx_log
  338. #define VCE_log2    VCD_log2
  339. #define VCEx_log2   VCDx_log2
  340. #define VCE_log10   VCD_log10
  341. #define VCEx_log10  VCDx_log10
  342. #define VCE_ln      VCE_log
  343. #define VCEx_ln     VCEx_log
  344. #define VCE_exp     VCD_exp
  345. #define VCEx_exp    VCDx_exp
  346. #define VCE_expArbBase  VCD_expArbBase
  347. #define VCEx_expArbBase VCDx_expArbBase
  348. #define VCE_sin     VCD_sin
  349. #define VCEx_sin    VCDx_sin
  350. #define VCE_cos     VCD_cos
  351. #define VCEx_cos    VCDx_cos
  352. #define VCE_tan     VCD_tan
  353. #define VCEx_tan    VCDx_tan
  354. #define VCE_asin    VCD_asin
  355. #define VCEx_asin   VCDx_asin
  356. #define VCE_acos    VCD_acos
  357. #define VCEx_acos   VCDx_acos
  358. #define VCE_atan    VCD_atan
  359. #define VCEx_atan   VCDx_atan
  360. #define VCE_sinh    VCD_sinh
  361. #define VCEx_sinh   VCDx_sinh
  362. #define VCE_cosh    VCD_cosh
  363. #define VCEx_cosh   VCDx_cosh
  364. #define VCE_tanh    VCD_tanh
  365. #define VCEx_tanh   VCDx_tanh
  366.  
  367. #endif  /* Borland or Microsoft */
  368.  
  369. #ifdef __cplusplus
  370. }
  371. #endif
  372.  
  373.  
  374. #endif /* __VCEMATH_H */
  375.