1 /************************************************************************* 2 Copyright (c) Sergey Bochkanov (ALGLIB project). 3 4 >>> SOURCE LICENSE >>> 5 This program 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 (www.fsf.org); either version 2 of the 8 License, or (at your option) any later version. 9 10 This program 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 A copy of the GNU General Public License is available at 16 http://www.fsf.org/licensing/licenses 17 >>> END OF LICENSE >>> 18 *************************************************************************/ 19 #ifndef _ap_h 20 #define _ap_h 21 22 #include <stdio.h> 23 #include <stdlib.h> 24 #include <stddef.h> 25 #include <string> 26 #include <cstring> 27 #include <math.h> 28 29 #ifdef __BORLANDC__ 30 #include <list.h> 31 #include <vector.h> 32 #else 33 #include <list> 34 #include <vector> 35 #endif 36 37 #define AE_USE_CPP 38 39 ///////////////////////////////////////////////////////////////////////// 40 // 41 // THIS SECTION CONTAINS DECLARATIONS FOR BASIC FUNCTIONALITY 42 // LIKE MEMORY MANAGEMENT FOR VECTORS/MATRICES WHICH IS SHARED 43 // BETWEEN C++ AND PURE C LIBRARIES 44 // 45 ///////////////////////////////////////////////////////////////////////// 46 namespace alglib_impl 47 { 48 /* 49 * definitions 50 */ 51 #define AE_UNKNOWN 0 52 #define AE_MSVC 1 53 #define AE_GNUC 2 54 #define AE_SUNC 3 55 #define AE_INTEL 1 56 #define AE_SPARC 2 57 58 /* 59 * automatically determine compiler 60 */ 61 #define AE_COMPILER AE_UNKNOWN 62 #ifdef __GNUC__ 63 #undef AE_COMPILER 64 #define AE_COMPILER AE_GNUC 65 #endif 66 #if defined(__SUNPRO_C)||defined(__SUNPRO_CC) 67 #undef AE_COMPILER 68 #define AE_COMPILER AE_SUNC 69 #endif 70 #ifdef _MSC_VER 71 #undef AE_COMPILER 72 #define AE_COMPILER AE_MSVC 73 #endif 74 75 /* 76 * if we work under C++ environment, define several conditions 77 */ 78 #ifdef AE_USE_CPP 79 #define AE_USE_CPP_BOOL 80 #define AE_USE_CPP_ERROR_HANDLING 81 #define AE_USE_CPP_SERIALIZATION 82 #endif 83 84 85 /* 86 * define ae_int32_t, ae_int64_t, ae_int_t, ae_bool, ae_complex, ae_error_type and ae_datatype 87 */ 88 #if defined(AE_HAVE_STDINT) 89 #include <stdint.h> 90 #endif 91 92 #if defined(AE_INT32_T) 93 typedef AE_INT32_T ae_int32_t; 94 #endif 95 #if defined(AE_HAVE_STDINT) && !defined(AE_INT32_T) 96 typedef int32_t ae_int32_t; 97 #endif 98 #if !defined(AE_HAVE_STDINT) && !defined(AE_INT32_T) 99 #if AE_COMPILER==AE_MSVC 100 typedef _int32 ae_int32_t; 101 #endif 102 #if (AE_COMPILER==AE_GNUC) || (AE_COMPILER==AE_SUNC) || (AE_COMPILER==AE_UNKNOWN) 103 typedef int ae_int32_t; 104 #endif 105 #endif 106 107 #if defined(AE_INT64_T) 108 typedef AE_INT64_T ae_int64_t; 109 #endif 110 #if defined(AE_HAVE_STDINT) && !defined(AE_INT64_T) 111 typedef int64_t ae_int64_t; 112 #endif 113 #if !defined(AE_HAVE_STDINT) && !defined(AE_INT64_T) 114 #if AE_COMPILER==AE_MSVC 115 typedef _int64 ae_int64_t; 116 #endif 117 #if (AE_COMPILER==AE_GNUC) || (AE_COMPILER==AE_SUNC) || (AE_COMPILER==AE_UNKNOWN) 118 typedef signed long long ae_int64_t; 119 #endif 120 #endif 121 122 #if !defined(AE_INT_T) 123 typedef ptrdiff_t ae_int_t; 124 #endif 125 126 #if !defined(AE_USE_CPP_BOOL) 127 #define ae_bool char 128 #define ae_true 1 129 #define ae_false 0 130 #else 131 #define ae_bool bool 132 #define ae_true true 133 #define ae_false false 134 #endif 135 136 137 /* 138 * SSE2 intrinsics 139 * 140 * Preprocessor directives below: 141 * - include headers for SSE2 intrinsics 142 * - define AE_HAS_SSE2_INTRINSICS definition 143 * 144 * These actions are performed when we have: 145 * - x86 architecture definition (AE_CPU==AE_INTEL) 146 * - compiler which supports intrinsics 147 * 148 * Presence of AE_HAS_SSE2_INTRINSICS does NOT mean that our CPU 149 * actually supports SSE2 - such things should be determined at runtime 150 * with ae_cpuid() call. It means that we are working under Intel and 151 * out compiler can issue SSE2-capable code. 152 * 153 */ 154 #if defined(AE_CPU) 155 #if AE_CPU==AE_INTEL 156 157 #ifdef AE_USE_CPP 158 } // end of namespace declaration, subsequent includes must be out of namespace 159 #endif 160 161 #if AE_COMPILER==AE_MSVC 162 #include <emmintrin.h> 163 #define AE_HAS_SSE2_INTRINSICS 164 #endif 165 166 #if AE_COMPILER==AE_GNUC 167 #include <xmmintrin.h> 168 #define AE_HAS_SSE2_INTRINSICS 169 #endif 170 171 #if AE_COMPILER==AE_SUNC 172 #include <xmmintrin.h> 173 #include <emmintrin.h> 174 #define AE_HAS_SSE2_INTRINSICS 175 #endif 176 177 #ifdef AE_USE_CPP 178 namespace alglib_impl { // namespace declaration continued 179 #endif 180 181 #endif 182 #endif 183 184 185 typedef struct { double x, y; } ae_complex; 186 187 typedef enum 188 { 189 ERR_OK = 0, 190 ERR_OUT_OF_MEMORY = 1, 191 ERR_XARRAY_TOO_LARGE = 2, 192 ERR_ASSERTION_FAILED = 3 193 } ae_error_type; 194 195 typedef ae_int_t ae_datatype; 196 197 /* 198 * other definitions 199 */ 200 enum { OWN_CALLER=1, OWN_AE=2 }; 201 enum { ACT_UNCHANGED=1, ACT_SAME_LOCATION=2, ACT_NEW_LOCATION=3 }; 202 enum { DT_BOOL=1, DT_INT=2, DT_REAL=3, DT_COMPLEX=4 }; 203 enum { CPU_SSE2=1 }; 204 205 206 /************************************************************************ 207 x-string (zero-terminated): 208 owner OWN_CALLER or OWN_AE. Determines what to do on realloc(). 209 If vector is owned by caller, X-interface will just set 210 ptr to NULL before realloc(). If it is owned by X, it 211 will call ae_free/x_free/aligned_free family functions. 212 213 last_action ACT_UNCHANGED, ACT_SAME_LOCATION, ACT_NEW_LOCATION 214 contents is either: unchanged, stored at the same location, 215 stored at the new location. 216 this field is set on return from X. 217 218 ptr pointer to the actual data 219 220 Members of this structure are ae_int64_t to avoid alignment problems. 221 ************************************************************************/ 222 typedef struct 223 { 224 ae_int64_t owner; 225 ae_int64_t last_action; 226 char *ptr; 227 } x_string; 228 229 /************************************************************************ 230 x-vector: 231 cnt number of elements 232 233 datatype one of the DT_XXXX values 234 235 owner OWN_CALLER or OWN_AE. Determines what to do on realloc(). 236 If vector is owned by caller, X-interface will just set 237 ptr to NULL before realloc(). If it is owned by X, it 238 will call ae_free/x_free/aligned_free family functions. 239 240 last_action ACT_UNCHANGED, ACT_SAME_LOCATION, ACT_NEW_LOCATION 241 contents is either: unchanged, stored at the same location, 242 stored at the new location. 243 this field is set on return from X interface and may be 244 used by caller as hint when deciding what to do with data 245 (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array 246 reallocation or copying is required). 247 248 ptr pointer to the actual data 249 250 Members of this structure are ae_int64_t to avoid alignment problems. 251 ************************************************************************/ 252 typedef struct 253 { 254 ae_int64_t cnt; 255 ae_int64_t datatype; 256 ae_int64_t owner; 257 ae_int64_t last_action; 258 void *ptr; 259 } x_vector; 260 261 262 /************************************************************************ 263 x-matrix: 264 rows number of rows. may be zero only when cols is zero too. 265 266 cols number of columns. may be zero only when rows is zero too. 267 268 stride stride, i.e. distance between first elements of rows (in bytes) 269 270 datatype one of the DT_XXXX values 271 272 owner OWN_CALLER or OWN_AE. Determines what to do on realloc(). 273 If vector is owned by caller, X-interface will just set 274 ptr to NULL before realloc(). If it is owned by X, it 275 will call ae_free/x_free/aligned_free family functions. 276 277 last_action ACT_UNCHANGED, ACT_SAME_LOCATION, ACT_NEW_LOCATION 278 contents is either: unchanged, stored at the same location, 279 stored at the new location. 280 this field is set on return from X interface and may be 281 used by caller as hint when deciding what to do with data 282 (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array 283 reallocation or copying is required). 284 285 ptr pointer to the actual data, stored rowwise 286 287 Members of this structure are ae_int64_t to avoid alignment problems. 288 ************************************************************************/ 289 typedef struct 290 { 291 ae_int64_t rows; 292 ae_int64_t cols; 293 ae_int64_t stride; 294 ae_int64_t datatype; 295 ae_int64_t owner; 296 ae_int64_t last_action; 297 void *ptr; 298 } x_matrix; 299 300 301 /************************************************************************ 302 dynamic block which may be automatically deallocated during stack unwinding 303 304 p_next next block in the stack unwinding list. 305 NULL means that this block is not in the list 306 deallocator deallocator function which should be used to deallocate block. 307 NULL for "special" blocks (frame/stack boundaries) 308 ptr pointer which should be passed to the deallocator. 309 may be null (for zero-size block), DYN_BOTTOM or DYN_FRAME 310 for "special" blocks (frame/stack boundaries). 311 312 ************************************************************************/ 313 typedef struct ae_dyn_block 314 { 315 struct ae_dyn_block * volatile p_next; 316 /* void *deallocator; */ 317 void (*deallocator)(void*); 318 void * volatile ptr; 319 } ae_dyn_block; 320 321 /************************************************************************ 322 frame marker 323 ************************************************************************/ 324 typedef struct ae_frame 325 { 326 ae_dyn_block db_marker; 327 } ae_frame; 328 329 /************************************************************************ 330 ALGLIB environment state 331 ************************************************************************/ 332 typedef struct 333 { 334 ae_int_t endianness; 335 double v_nan; 336 double v_posinf; 337 double v_neginf; 338 339 ae_dyn_block * volatile p_top_block; 340 ae_dyn_block last_block; 341 #ifndef AE_USE_CPP_ERROR_HANDLING 342 jmp_buf * volatile break_jump; 343 #endif 344 ae_error_type volatile last_error; 345 const char* volatile error_msg; 346 } ae_state; 347 348 /************************************************************************ 349 Serializer 350 ************************************************************************/ 351 typedef struct 352 { 353 ae_int_t mode; 354 ae_int_t entries_needed; 355 ae_int_t entries_saved; 356 ae_int_t bytes_asked; 357 ae_int_t bytes_written; 358 359 #ifdef AE_USE_CPP_SERIALIZATION 360 std::string *out_cppstr; 361 #endif 362 char *out_str; 363 const char *in_str; 364 } ae_serializer; 365 366 typedef void(*ae_deallocator)(void*); 367 368 typedef struct ae_vector 369 { 370 ae_int_t cnt; 371 ae_datatype datatype; 372 ae_dyn_block data; 373 union 374 { 375 void *p_ptr; 376 ae_bool *p_bool; 377 ae_int_t *p_int; 378 double *p_double; 379 ae_complex *p_complex; 380 } ptr; 381 } ae_vector; 382 383 typedef struct ae_matrix 384 { 385 ae_int_t rows; 386 ae_int_t cols; 387 ae_int_t stride; 388 ae_datatype datatype; 389 ae_dyn_block data; 390 union 391 { 392 void *p_ptr; 393 void **pp_void; 394 ae_bool **pp_bool; 395 ae_int_t **pp_int; 396 double **pp_double; 397 ae_complex **pp_complex; 398 } ptr; 399 } ae_matrix; 400 401 ae_int_t ae_misalignment(const void *ptr, size_t alignment); 402 void* ae_align(void *ptr, size_t alignment); 403 void* aligned_malloc(size_t size, size_t alignment); 404 void aligned_free(void *block); 405 406 void* ae_malloc(size_t size, ae_state *state); 407 void ae_free(void *p); 408 ae_int_t ae_sizeof(ae_datatype datatype); 409 410 void ae_state_init(ae_state *state); 411 void ae_state_clear(ae_state *state); 412 #ifndef AE_USE_CPP_ERROR_HANDLING 413 void ae_state_set_break_jump(ae_state *state, jmp_buf *buf); 414 #endif 415 void ae_break(ae_state *state, ae_error_type error_type, const char *msg); 416 417 void ae_frame_make(ae_state *state, ae_frame *tmp); 418 void ae_frame_leave(ae_state *state); 419 420 void ae_db_attach(ae_dyn_block *block, ae_state *state); 421 ae_bool ae_db_malloc(ae_dyn_block *block, ae_int_t size, ae_state *state, ae_bool make_automatic); 422 ae_bool ae_db_realloc(ae_dyn_block *block, ae_int_t size, ae_state *state); 423 void ae_db_free(ae_dyn_block *block); 424 void ae_db_swap(ae_dyn_block *block1, ae_dyn_block *block2); 425 426 ae_bool ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state, ae_bool make_automatic); 427 ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state, ae_bool make_automatic); 428 void ae_vector_init_from_x(ae_vector *dst, x_vector *src, ae_state *state, ae_bool make_automatic); 429 ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *state); 430 void ae_vector_clear(ae_vector *dst); 431 void ae_swap_vectors(ae_vector *vec1, ae_vector *vec2); 432 433 ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state, ae_bool make_automatic); 434 ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state, ae_bool make_automatic); 435 void ae_matrix_init_from_x(ae_matrix *dst, x_matrix *src, ae_state *state, ae_bool make_automatic); 436 ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state); 437 void ae_matrix_clear(ae_matrix *dst); 438 void ae_swap_matrices(ae_matrix *mat1, ae_matrix *mat2); 439 440 void ae_x_set_vector(x_vector *dst, ae_vector *src, ae_state *state); 441 void ae_x_set_matrix(x_matrix *dst, ae_matrix *src, ae_state *state); 442 void ae_x_attach_to_vector(x_vector *dst, ae_vector *src); 443 void ae_x_attach_to_matrix(x_matrix *dst, ae_matrix *src); 444 445 void x_vector_clear(x_vector *dst); 446 447 ae_bool x_is_symmetric(x_matrix *a); 448 ae_bool x_is_hermitian(x_matrix *a); 449 ae_bool x_force_symmetric(x_matrix *a); 450 ae_bool x_force_hermitian(x_matrix *a); 451 ae_bool ae_is_symmetric(ae_matrix *a); 452 ae_bool ae_is_hermitian(ae_matrix *a); 453 ae_bool ae_force_symmetric(ae_matrix *a); 454 ae_bool ae_force_hermitian(ae_matrix *a); 455 456 void ae_serializer_init(ae_serializer *serializer); 457 void ae_serializer_clear(ae_serializer *serializer); 458 459 void ae_serializer_alloc_start(ae_serializer *serializer); 460 void ae_serializer_alloc_entry(ae_serializer *serializer); 461 ae_int_t ae_serializer_get_alloc_size(ae_serializer *serializer); 462 463 #ifdef AE_USE_CPP_SERIALIZATION 464 void ae_serializer_sstart_str(ae_serializer *serializer, std::string *buf); 465 void ae_serializer_ustart_str(ae_serializer *serializer, const std::string *buf); 466 #endif 467 void ae_serializer_sstart_str(ae_serializer *serializer, char *buf); 468 void ae_serializer_ustart_str(ae_serializer *serializer, const char *buf); 469 470 void ae_serializer_serialize_bool(ae_serializer *serializer, ae_bool v, ae_state *state); 471 void ae_serializer_serialize_int(ae_serializer *serializer, ae_int_t v, ae_state *state); 472 void ae_serializer_serialize_double(ae_serializer *serializer, double v, ae_state *state); 473 void ae_serializer_unserialize_bool(ae_serializer *serializer, ae_bool *v, ae_state *state); 474 void ae_serializer_unserialize_int(ae_serializer *serializer, ae_int_t *v, ae_state *state); 475 void ae_serializer_unserialize_double(ae_serializer *serializer, double *v, ae_state *state); 476 477 void ae_serializer_stop(ae_serializer *serializer); 478 479 /************************************************************************ 480 Service functions 481 ************************************************************************/ 482 void ae_assert(ae_bool cond, const char *msg, ae_state *state); 483 ae_int_t ae_cpuid(); 484 485 /************************************************************************ 486 Real math functions: 487 * IEEE-compliant floating point comparisons 488 * standard functions 489 ************************************************************************/ 490 ae_bool ae_fp_eq(double v1, double v2); 491 ae_bool ae_fp_neq(double v1, double v2); 492 ae_bool ae_fp_less(double v1, double v2); 493 ae_bool ae_fp_less_eq(double v1, double v2); 494 ae_bool ae_fp_greater(double v1, double v2); 495 ae_bool ae_fp_greater_eq(double v1, double v2); 496 497 ae_bool ae_isfinite_stateless(double x, ae_int_t endianness); 498 ae_bool ae_isnan_stateless(double x, ae_int_t endianness); 499 ae_bool ae_isinf_stateless(double x, ae_int_t endianness); 500 ae_bool ae_isposinf_stateless(double x, ae_int_t endianness); 501 ae_bool ae_isneginf_stateless(double x, ae_int_t endianness); 502 503 ae_int_t ae_get_endianness(); 504 505 ae_bool ae_isfinite(double x,ae_state *state); 506 ae_bool ae_isnan(double x, ae_state *state); 507 ae_bool ae_isinf(double x, ae_state *state); 508 ae_bool ae_isposinf(double x,ae_state *state); 509 ae_bool ae_isneginf(double x,ae_state *state); 510 511 double ae_fabs(double x, ae_state *state); 512 ae_int_t ae_iabs(ae_int_t x, ae_state *state); 513 double ae_sqr(double x, ae_state *state); 514 double ae_sqrt(double x, ae_state *state); 515 516 ae_int_t ae_sign(double x, ae_state *state); 517 ae_int_t ae_round(double x, ae_state *state); 518 ae_int_t ae_trunc(double x, ae_state *state); 519 ae_int_t ae_ifloor(double x, ae_state *state); 520 ae_int_t ae_iceil(double x, ae_state *state); 521 522 ae_int_t ae_maxint(ae_int_t m1, ae_int_t m2, ae_state *state); 523 ae_int_t ae_minint(ae_int_t m1, ae_int_t m2, ae_state *state); 524 double ae_maxreal(double m1, double m2, ae_state *state); 525 double ae_minreal(double m1, double m2, ae_state *state); 526 double ae_randomreal(ae_state *state); 527 ae_int_t ae_randominteger(ae_int_t maxv, ae_state *state); 528 529 double ae_sin(double x, ae_state *state); 530 double ae_cos(double x, ae_state *state); 531 double ae_tan(double x, ae_state *state); 532 double ae_sinh(double x, ae_state *state); 533 double ae_cosh(double x, ae_state *state); 534 double ae_tanh(double x, ae_state *state); 535 double ae_asin(double x, ae_state *state); 536 double ae_acos(double x, ae_state *state); 537 double ae_atan(double x, ae_state *state); 538 double ae_atan2(double x, double y, ae_state *state); 539 540 double ae_log(double x, ae_state *state); 541 double ae_pow(double x, double y, ae_state *state); 542 double ae_exp(double x, ae_state *state); 543 544 /************************************************************************ 545 Complex math functions: 546 * basic arithmetic operations 547 * standard functions 548 ************************************************************************/ 549 ae_complex ae_complex_from_d(double v); 550 551 ae_complex ae_c_neg(ae_complex lhs); 552 ae_bool ae_c_eq(ae_complex lhs, ae_complex rhs); 553 ae_bool ae_c_neq(ae_complex lhs, ae_complex rhs); 554 ae_complex ae_c_add(ae_complex lhs, ae_complex rhs); 555 ae_complex ae_c_mul(ae_complex lhs, ae_complex rhs); 556 ae_complex ae_c_sub(ae_complex lhs, ae_complex rhs); 557 ae_complex ae_c_div(ae_complex lhs, ae_complex rhs); 558 ae_bool ae_c_eq_d(ae_complex lhs, double rhs); 559 ae_bool ae_c_neq_d(ae_complex lhs, double rhs); 560 ae_complex ae_c_add_d(ae_complex lhs, double rhs); 561 ae_complex ae_c_mul_d(ae_complex lhs, double rhs); 562 ae_complex ae_c_sub_d(ae_complex lhs, double rhs); 563 ae_complex ae_c_d_sub(double lhs, ae_complex rhs); 564 ae_complex ae_c_div_d(ae_complex lhs, double rhs); 565 ae_complex ae_c_d_div(double lhs, ae_complex rhs); 566 567 ae_complex ae_c_conj(ae_complex lhs, ae_state *state); 568 ae_complex ae_c_sqr(ae_complex lhs, ae_state *state); 569 double ae_c_abs(ae_complex z, ae_state *state); 570 571 /************************************************************************ 572 Complex BLAS operations 573 ************************************************************************/ 574 ae_complex ae_v_cdotproduct(const ae_complex *v0, ae_int_t stride0, const char *conj0, const ae_complex *v1, ae_int_t stride1, const char *conj1, ae_int_t n); 575 void ae_v_cmove(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 576 void ae_v_cmoveneg(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 577 void ae_v_cmoved(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha); 578 void ae_v_cmovec(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha); 579 void ae_v_cadd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 580 void ae_v_caddd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha); 581 void ae_v_caddc(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha); 582 void ae_v_csub(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 583 void ae_v_csubd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha); 584 void ae_v_csubc(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha); 585 void ae_v_cmuld(ae_complex *vdst, ae_int_t stride_dst, ae_int_t n, double alpha); 586 void ae_v_cmulc(ae_complex *vdst, ae_int_t stride_dst, ae_int_t n, ae_complex alpha); 587 588 /************************************************************************ 589 Real BLAS operations 590 ************************************************************************/ 591 double ae_v_dotproduct(const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n); 592 void ae_v_move(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n); 593 void ae_v_moveneg(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n); 594 void ae_v_moved(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n, double alpha); 595 void ae_v_add(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n); 596 void ae_v_addd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha); 597 void ae_v_sub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n); 598 void ae_v_subd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha); 599 void ae_v_muld(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha); 600 601 /************************************************************************ 602 Other functions 603 ************************************************************************/ 604 ae_int_t ae_v_len(ae_int_t a, ae_int_t b); 605 606 /* 607 extern const double ae_machineepsilon; 608 extern const double ae_maxrealnumber; 609 extern const double ae_minrealnumber; 610 extern const double ae_pi; 611 */ 612 #define ae_machineepsilon 5E-16 613 #define ae_maxrealnumber 1E300 614 #define ae_minrealnumber 1E-300 615 #define ae_pi 3.1415926535897932384626433832795 616 617 618 /************************************************************************ 619 RComm functions 620 ************************************************************************/ 621 typedef struct rcommstate 622 { 623 int stage; 624 ae_vector ia; 625 ae_vector ba; 626 ae_vector ra; 627 ae_vector ca; 628 } rcommstate; 629 ae_bool _rcommstate_init(rcommstate* p, ae_state *_state, ae_bool make_automatic); 630 ae_bool _rcommstate_init_copy(rcommstate* dst, rcommstate* src, ae_state *_state, ae_bool make_automatic); 631 void _rcommstate_clear(rcommstate* p); 632 633 #ifdef AE_USE_ALLOC_COUNTER 634 extern ae_int64_t _alloc_counter; 635 #endif 636 637 638 /************************************************************************ 639 debug functions (must be turned on by preprocessor definitions: 640 * tickcount(), which is wrapper around GetTickCount() 641 ************************************************************************/ 642 #ifdef AE_DEBUG4WINDOWS 643 #include <windows.h> 644 #include <stdio.h> 645 #define tickcount(s) GetTickCount() 646 #define flushconsole(s) fflush(stdout) 647 #endif 648 649 650 651 } 652 653 654 ///////////////////////////////////////////////////////////////////////// 655 // 656 // THIS SECTION CONTAINS DECLARATIONS FOR C++ RELATED FUNCTIONALITY 657 // 658 ///////////////////////////////////////////////////////////////////////// 659 660 namespace alglib 661 { 662 663 typedef alglib_impl::ae_int_t ae_int_t; 664 665 /******************************************************************** 666 Class forwards 667 ********************************************************************/ 668 class complex; 669 670 ae_int_t vlen(ae_int_t n1, ae_int_t n2); 671 672 /******************************************************************** 673 Exception class. 674 ********************************************************************/ 675 class ap_error 676 { 677 public: 678 std::string msg; 679 680 ap_error(); 681 ap_error(const char *s); 682 static void make_assertion(bool bClause); 683 static void make_assertion(bool bClause, const char *msg); 684 private: 685 }; 686 687 /******************************************************************** 688 Complex number with double precision. 689 ********************************************************************/ 690 class complex 691 { 692 public: 693 complex(); 694 complex(const double &_x); 695 complex(const double &_x, const double &_y); 696 complex(const complex &z); 697 698 complex& operator= (const double& v); 699 complex& operator+=(const double& v); 700 complex& operator-=(const double& v); 701 complex& operator*=(const double& v); 702 complex& operator/=(const double& v); 703 704 complex& operator= (const complex& z); 705 complex& operator+=(const complex& z); 706 complex& operator-=(const complex& z); 707 complex& operator*=(const complex& z); 708 complex& operator/=(const complex& z); 709 710 alglib_impl::ae_complex* c_ptr(); 711 const alglib_impl::ae_complex* c_ptr() const; 712 713 std::string tostring(int dps) const; 714 715 double x, y; 716 }; 717 718 const alglib::complex operator/(const alglib::complex& lhs, const alglib::complex& rhs); 719 const bool operator==(const alglib::complex& lhs, const alglib::complex& rhs); 720 const bool operator!=(const alglib::complex& lhs, const alglib::complex& rhs); 721 const alglib::complex operator+(const alglib::complex& lhs); 722 const alglib::complex operator-(const alglib::complex& lhs); 723 const alglib::complex operator+(const alglib::complex& lhs, const alglib::complex& rhs); 724 const alglib::complex operator+(const alglib::complex& lhs, const double& rhs); 725 const alglib::complex operator+(const double& lhs, const alglib::complex& rhs); 726 const alglib::complex operator-(const alglib::complex& lhs, const alglib::complex& rhs); 727 const alglib::complex operator-(const alglib::complex& lhs, const double& rhs); 728 const alglib::complex operator-(const double& lhs, const alglib::complex& rhs); 729 const alglib::complex operator*(const alglib::complex& lhs, const alglib::complex& rhs); 730 const alglib::complex operator*(const alglib::complex& lhs, const double& rhs); 731 const alglib::complex operator*(const double& lhs, const alglib::complex& rhs); 732 const alglib::complex operator/(const alglib::complex& lhs, const alglib::complex& rhs); 733 const alglib::complex operator/(const double& lhs, const alglib::complex& rhs); 734 const alglib::complex operator/(const alglib::complex& lhs, const double& rhs); 735 double abscomplex(const alglib::complex &z); 736 alglib::complex conj(const alglib::complex &z); 737 alglib::complex csqr(const alglib::complex &z); 738 739 /******************************************************************** 740 Level 1 BLAS functions 741 742 NOTES: 743 * destination and source should NOT overlap 744 * stride is assumed to be positive, but it is not 745 assert'ed within function 746 * conj_src parameter specifies whether complex source is conjugated 747 before processing or not. Pass string which starts with 'N' or 'n' 748 ("No conj", for example) to use unmodified parameter. All other 749 values will result in conjugation of input, but it is recommended 750 to use "Conj" in such cases. 751 ********************************************************************/ 752 double vdotproduct(const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n); 753 double vdotproduct(const double *v1, const double *v2, ae_int_t N); 754 755 alglib::complex vdotproduct(const alglib::complex *v0, ae_int_t stride0, const char *conj0, const alglib::complex *v1, ae_int_t stride1, const char *conj1, ae_int_t n); 756 alglib::complex vdotproduct(const alglib::complex *v1, const alglib::complex *v2, ae_int_t N); 757 758 void vmove(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n); 759 void vmove(double *vdst, const double* vsrc, ae_int_t N); 760 761 void vmove(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 762 void vmove(alglib::complex *vdst, const alglib::complex* vsrc, ae_int_t N); 763 764 void vmoveneg(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n); 765 void vmoveneg(double *vdst, const double *vsrc, ae_int_t N); 766 767 void vmoveneg(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 768 void vmoveneg(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N); 769 770 void vmove(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n, double alpha); 771 void vmove(double *vdst, const double *vsrc, ae_int_t N, double alpha); 772 773 void vmove(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha); 774 void vmove(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, double alpha); 775 776 void vmove(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, alglib::complex alpha); 777 void vmove(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, alglib::complex alpha); 778 779 void vadd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n); 780 void vadd(double *vdst, const double *vsrc, ae_int_t N); 781 782 void vadd(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 783 void vadd(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N); 784 785 void vadd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha); 786 void vadd(double *vdst, const double *vsrc, ae_int_t N, double alpha); 787 788 void vadd(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha); 789 void vadd(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, double alpha); 790 791 void vadd(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, alglib::complex alpha); 792 void vadd(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, alglib::complex alpha); 793 794 void vsub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n); 795 void vsub(double *vdst, const double *vsrc, ae_int_t N); 796 797 void vsub(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n); 798 void vsub(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N); 799 800 void vsub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha); 801 void vsub(double *vdst, const double *vsrc, ae_int_t N, double alpha); 802 803 void vsub(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha); 804 void vsub(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, double alpha); 805 806 void vsub(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, alglib::complex alpha); 807 void vsub(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, alglib::complex alpha); 808 809 void vmul(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha); 810 void vmul(double *vdst, ae_int_t N, double alpha); 811 812 void vmul(alglib::complex *vdst, ae_int_t stride_dst, ae_int_t n, double alpha); 813 void vmul(alglib::complex *vdst, ae_int_t N, double alpha); 814 815 void vmul(alglib::complex *vdst, ae_int_t stride_dst, ae_int_t n, alglib::complex alpha); 816 void vmul(alglib::complex *vdst, ae_int_t N, alglib::complex alpha); 817 818 819 820 /******************************************************************** 821 string conversion functions !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 822 ********************************************************************/ 823 824 /******************************************************************** 825 1- and 2-dimensional arrays 826 ********************************************************************/ 827 class ae_vector_wrapper 828 { 829 public: 830 ae_vector_wrapper(); 831 virtual ~ae_vector_wrapper(); 832 ae_vector_wrapper(const ae_vector_wrapper &rhs); 833 const ae_vector_wrapper& operator=(const ae_vector_wrapper &rhs); 834 835 void setlength(ae_int_t iLen); 836 ae_int_t length() const; 837 838 void attach_to(alglib_impl::ae_vector *ptr); 839 void allocate_own(ae_int_t size, alglib_impl::ae_datatype datatype); 840 const alglib_impl::ae_vector* c_ptr() const; 841 alglib_impl::ae_vector* c_ptr(); 842 protected: 843 alglib_impl::ae_vector *p_vec; 844 alglib_impl::ae_vector vec; 845 }; 846 847 class boolean_1d_array : public ae_vector_wrapper 848 { 849 public: 850 boolean_1d_array(); 851 boolean_1d_array(const char *s); 852 boolean_1d_array(alglib_impl::ae_vector *p); 853 virtual ~boolean_1d_array() ; 854 855 const ae_bool& operator()(ae_int_t i) const; 856 ae_bool& operator()(ae_int_t i); 857 858 const ae_bool& operator[](ae_int_t i) const; 859 ae_bool& operator[](ae_int_t i); 860 861 void setcontent(ae_int_t iLen, const bool *pContent ); 862 ae_bool* getcontent(); 863 const ae_bool* getcontent() const; 864 865 std::string tostring() const; 866 }; 867 868 class integer_1d_array : public ae_vector_wrapper 869 { 870 public: 871 integer_1d_array(); 872 integer_1d_array(alglib_impl::ae_vector *p); 873 integer_1d_array(const char *s); 874 virtual ~integer_1d_array(); 875 876 const ae_int_t& operator()(ae_int_t i) const; 877 ae_int_t& operator()(ae_int_t i); 878 879 const ae_int_t& operator[](ae_int_t i) const; 880 ae_int_t& operator[](ae_int_t i); 881 882 void setcontent(ae_int_t iLen, const ae_int_t *pContent ); 883 884 ae_int_t* getcontent(); 885 const ae_int_t* getcontent() const; 886 887 std::string tostring() const; 888 }; 889 890 class real_1d_array : public ae_vector_wrapper 891 { 892 public: 893 real_1d_array(); 894 real_1d_array(alglib_impl::ae_vector *p); 895 real_1d_array(const char *s); 896 virtual ~real_1d_array(); 897 898 const double& operator()(ae_int_t i) const; 899 double& operator()(ae_int_t i); 900 901 const double& operator[](ae_int_t i) const; 902 double& operator[](ae_int_t i); 903 904 void setcontent(ae_int_t iLen, const double *pContent ); 905 double* getcontent(); 906 const double* getcontent() const; 907 908 std::string tostring(int dps) const; 909 }; 910 911 class complex_1d_array : public ae_vector_wrapper 912 { 913 public: 914 complex_1d_array(); 915 complex_1d_array(alglib_impl::ae_vector *p); 916 complex_1d_array(const char *s); 917 virtual ~complex_1d_array(); 918 919 const alglib::complex& operator()(ae_int_t i) const; 920 alglib::complex& operator()(ae_int_t i); 921 922 const alglib::complex& operator[](ae_int_t i) const; 923 alglib::complex& operator[](ae_int_t i); 924 925 void setcontent(ae_int_t iLen, const alglib::complex *pContent ); 926 alglib::complex* getcontent(); 927 const alglib::complex* getcontent() const; 928 929 std::string tostring(int dps) const; 930 }; 931 932 class ae_matrix_wrapper 933 { 934 public: 935 ae_matrix_wrapper(); 936 virtual ~ae_matrix_wrapper(); 937 ae_matrix_wrapper(const ae_matrix_wrapper &rhs); 938 const ae_matrix_wrapper& operator=(const ae_matrix_wrapper &rhs); 939 940 void setlength(ae_int_t rows, ae_int_t cols); 941 ae_int_t rows() const; 942 ae_int_t cols() const; 943 bool isempty() const; 944 ae_int_t getstride() const; 945 946 void attach_to(alglib_impl::ae_matrix *ptr); 947 void allocate_own(ae_int_t rows, ae_int_t cols, alglib_impl::ae_datatype datatype); 948 const alglib_impl::ae_matrix* c_ptr() const; 949 alglib_impl::ae_matrix* c_ptr(); 950 protected: 951 alglib_impl::ae_matrix *p_mat; 952 alglib_impl::ae_matrix mat; 953 }; 954 955 class boolean_2d_array : public ae_matrix_wrapper 956 { 957 public: 958 boolean_2d_array(); 959 boolean_2d_array(alglib_impl::ae_matrix *p); 960 boolean_2d_array(const char *s); 961 virtual ~boolean_2d_array(); 962 963 const ae_bool& operator()(ae_int_t i, ae_int_t j) const; 964 ae_bool& operator()(ae_int_t i, ae_int_t j); 965 966 const ae_bool* operator[](ae_int_t i) const; 967 ae_bool* operator[](ae_int_t i); 968 969 void setcontent(ae_int_t irows, ae_int_t icols, const bool *pContent ); 970 971 std::string tostring() const ; 972 }; 973 974 class integer_2d_array : public ae_matrix_wrapper 975 { 976 public: 977 integer_2d_array(); 978 integer_2d_array(alglib_impl::ae_matrix *p); 979 integer_2d_array(const char *s); 980 virtual ~integer_2d_array(); 981 982 const ae_int_t& operator()(ae_int_t i, ae_int_t j) const; 983 ae_int_t& operator()(ae_int_t i, ae_int_t j); 984 985 const ae_int_t* operator[](ae_int_t i) const; 986 ae_int_t* operator[](ae_int_t i); 987 988 void setcontent(ae_int_t irows, ae_int_t icols, const ae_int_t *pContent ); 989 990 std::string tostring() const; 991 }; 992 993 class real_2d_array : public ae_matrix_wrapper 994 { 995 public: 996 real_2d_array(); 997 real_2d_array(alglib_impl::ae_matrix *p); 998 real_2d_array(const char *s); 999 virtual ~real_2d_array(); 1000 1001 const double& operator()(ae_int_t i, ae_int_t j) const; 1002 double& operator()(ae_int_t i, ae_int_t j); 1003 1004 const double* operator[](ae_int_t i) const; 1005 double* operator[](ae_int_t i); 1006 1007 void setcontent(ae_int_t irows, ae_int_t icols, const double *pContent ); 1008 1009 std::string tostring(int dps) const; 1010 }; 1011 1012 class complex_2d_array : public ae_matrix_wrapper 1013 { 1014 public: 1015 complex_2d_array(); 1016 complex_2d_array(alglib_impl::ae_matrix *p); 1017 complex_2d_array(const char *s); 1018 virtual ~complex_2d_array(); 1019 1020 const alglib::complex& operator()(ae_int_t i, ae_int_t j) const; 1021 alglib::complex& operator()(ae_int_t i, ae_int_t j); 1022 1023 const alglib::complex* operator[](ae_int_t i) const; 1024 alglib::complex* operator[](ae_int_t i); 1025 1026 void setcontent(ae_int_t irows, ae_int_t icols, const alglib::complex *pContent ); 1027 1028 std::string tostring(int dps) const; 1029 }; 1030 1031 1032 /******************************************************************** 1033 dataset information. 1034 1035 can store regression dataset, classification dataset, or non-labeled 1036 task: 1037 * nout==0 means non-labeled task (clustering, for example) 1038 * nout>0 && nclasses==0 means regression task 1039 * nout>0 && nclasses>0 means classification task 1040 ********************************************************************/ 1041 /*class dataset 1042 { 1043 public: 1044 dataset():nin(0), nout(0), nclasses(0), trnsize(0), valsize(0), tstsize(0), totalsize(0){}; 1045 1046 int nin, nout, nclasses; 1047 1048 int trnsize; 1049 int valsize; 1050 int tstsize; 1051 int totalsize; 1052 1053 alglib::real_2d_array trn; 1054 alglib::real_2d_array val; 1055 alglib::real_2d_array tst; 1056 alglib::real_2d_array all; 1057 }; 1058 1059 bool opendataset(std::string file, dataset *pdataset); 1060 1061 // 1062 // internal functions 1063 // 1064 std::string strtolower(const std::string &s); 1065 bool readstrings(std::string file, std::list<std::string> *pOutput); 1066 bool readstrings(std::string file, std::list<std::string> *pOutput, std::string comment); 1067 void explodestring(std::string s, char sep, std::vector<std::string> *pOutput); 1068 std::string xtrim(std::string s);*/ 1069 1070 /******************************************************************** 1071 Constants and functions introduced for compatibility with AlgoPascal 1072 ********************************************************************/ 1073 extern const double machineepsilon; 1074 extern const double maxrealnumber; 1075 extern const double minrealnumber; 1076 extern const double fp_nan; 1077 extern const double fp_posinf; 1078 extern const double fp_neginf; 1079 extern const ae_int_t endianness; 1080 1081 int sign2(double x); 1082 double randomreal(); 1083 int randominteger(int maxv); 1084 int round(double x); 1085 int trunc(double x); 1086 int ifloor(double x); 1087 int iceil(double x); 1088 double pi(); 1089 double sqr(double x); 1090 int maxint(int m1, int m2); 1091 int minint(int m1, int m2); 1092 double maxreal(double m1, double m2); 1093 double minreal(double m1, double m2); 1094 1095 bool fp_eq(double v1, double v2); 1096 bool fp_neq(double v1, double v2); 1097 bool fp_less(double v1, double v2); 1098 bool fp_less_eq(double v1, double v2); 1099 bool fp_greater(double v1, double v2); 1100 bool fp_greater_eq(double v1, double v2); 1101 1102 bool fp_isnan(double x); 1103 bool fp_isposinf(double x); 1104 bool fp_isneginf(double x); 1105 bool fp_isinf(double x); 1106 bool fp_isfinite(double x); 1107 1108 1109 }//namespace alglib 1110 1111 1112 ///////////////////////////////////////////////////////////////////////// 1113 // 1114 // THIS SECTIONS CONTAINS DECLARATIONS FOR OPTIMIZED LINEAR ALGEBRA CODES 1115 // IT IS SHARED BETWEEN C++ AND PURE C LIBRARIES 1116 // 1117 ///////////////////////////////////////////////////////////////////////// 1118 namespace alglib_impl 1119 { 1120 #define ALGLIB_INTERCEPTS_ABLAS 1121 1122 void _ialglib_vzero(ae_int_t n, double *p, ae_int_t stride); 1123 void _ialglib_vzero_complex(ae_int_t n, ae_complex *p, ae_int_t stride); 1124 void _ialglib_vcopy(ae_int_t n, const double *a, ae_int_t stridea, double *b, ae_int_t strideb); 1125 void _ialglib_vcopy_complex(ae_int_t n, const ae_complex *a, ae_int_t stridea, double *b, ae_int_t strideb, const char *conj); 1126 void _ialglib_vcopy_dcomplex(ae_int_t n, const double *a, ae_int_t stridea, double *b, ae_int_t strideb, const char *conj); 1127 void _ialglib_mcopyblock(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, ae_int_t stride, double *b); 1128 void _ialglib_mcopyunblock(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, double *b, ae_int_t stride); 1129 void _ialglib_mcopyblock_complex(ae_int_t m, ae_int_t n, const ae_complex *a, ae_int_t op, ae_int_t stride, double *b); 1130 void _ialglib_mcopyunblock_complex(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, ae_complex* b, ae_int_t stride); 1131 1132 ae_bool _ialglib_i_rmatrixgemmf(ae_int_t m, 1133 ae_int_t n, 1134 ae_int_t k, 1135 double alpha, 1136 ae_matrix *a, 1137 ae_int_t ia, 1138 ae_int_t ja, 1139 ae_int_t optypea, 1140 ae_matrix *b, 1141 ae_int_t ib, 1142 ae_int_t jb, 1143 ae_int_t optypeb, 1144 double beta, 1145 ae_matrix *c, 1146 ae_int_t ic, 1147 ae_int_t jc); 1148 ae_bool _ialglib_i_cmatrixgemmf(ae_int_t m, 1149 ae_int_t n, 1150 ae_int_t k, 1151 ae_complex alpha, 1152 ae_matrix *a, 1153 ae_int_t ia, 1154 ae_int_t ja, 1155 ae_int_t optypea, 1156 ae_matrix *b, 1157 ae_int_t ib, 1158 ae_int_t jb, 1159 ae_int_t optypeb, 1160 ae_complex beta, 1161 ae_matrix *c, 1162 ae_int_t ic, 1163 ae_int_t jc); 1164 ae_bool _ialglib_i_cmatrixrighttrsmf(ae_int_t m, 1165 ae_int_t n, 1166 ae_matrix *a, 1167 ae_int_t i1, 1168 ae_int_t j1, 1169 ae_bool isupper, 1170 ae_bool isunit, 1171 ae_int_t optype, 1172 ae_matrix *x, 1173 ae_int_t i2, 1174 ae_int_t j2); 1175 ae_bool _ialglib_i_rmatrixrighttrsmf(ae_int_t m, 1176 ae_int_t n, 1177 ae_matrix *a, 1178 ae_int_t i1, 1179 ae_int_t j1, 1180 ae_bool isupper, 1181 ae_bool isunit, 1182 ae_int_t optype, 1183 ae_matrix *x, 1184 ae_int_t i2, 1185 ae_int_t j2); 1186 ae_bool _ialglib_i_cmatrixlefttrsmf(ae_int_t m, 1187 ae_int_t n, 1188 ae_matrix *a, 1189 ae_int_t i1, 1190 ae_int_t j1, 1191 ae_bool isupper, 1192 ae_bool isunit, 1193 ae_int_t optype, 1194 ae_matrix *x, 1195 ae_int_t i2, 1196 ae_int_t j2); 1197 ae_bool _ialglib_i_rmatrixlefttrsmf(ae_int_t m, 1198 ae_int_t n, 1199 ae_matrix *a, 1200 ae_int_t i1, 1201 ae_int_t j1, 1202 ae_bool isupper, 1203 ae_bool isunit, 1204 ae_int_t optype, 1205 ae_matrix *x, 1206 ae_int_t i2, 1207 ae_int_t j2); 1208 ae_bool _ialglib_i_cmatrixsyrkf(ae_int_t n, 1209 ae_int_t k, 1210 double alpha, 1211 ae_matrix *a, 1212 ae_int_t ia, 1213 ae_int_t ja, 1214 ae_int_t optypea, 1215 double beta, 1216 ae_matrix *c, 1217 ae_int_t ic, 1218 ae_int_t jc, 1219 ae_bool isupper); 1220 ae_bool _ialglib_i_rmatrixsyrkf(ae_int_t n, 1221 ae_int_t k, 1222 double alpha, 1223 ae_matrix *a, 1224 ae_int_t ia, 1225 ae_int_t ja, 1226 ae_int_t optypea, 1227 double beta, 1228 ae_matrix *c, 1229 ae_int_t ic, 1230 ae_int_t jc, 1231 ae_bool isupper); 1232 ae_bool _ialglib_i_cmatrixrank1f(ae_int_t m, 1233 ae_int_t n, 1234 ae_matrix *a, 1235 ae_int_t ia, 1236 ae_int_t ja, 1237 ae_vector *u, 1238 ae_int_t uoffs, 1239 ae_vector *v, 1240 ae_int_t voffs); 1241 ae_bool _ialglib_i_rmatrixrank1f(ae_int_t m, 1242 ae_int_t n, 1243 ae_matrix *a, 1244 ae_int_t ia, 1245 ae_int_t ja, 1246 ae_vector *u, 1247 ae_int_t uoffs, 1248 ae_vector *v, 1249 ae_int_t voffs); 1250 1251 } 1252 1253 #endif 1254 1255