1 /* blas/gsl_blas.h 2 * 3 * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman 4 * 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; either version 3 of the License, or (at 8 * your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 */ 19 20 /* 21 * Author: G. Jungman 22 */ 23 #ifndef __GSL_BLAS_H__ 24 #define __GSL_BLAS_H__ 25 26 #include "gsl_vector.h" 27 #include "gsl_matrix.h" 28 29 #include "gsl_blas_types.h" 30 31 32 #undef __BEGIN_DECLS 33 #undef __END_DECLS 34 #ifdef __cplusplus 35 # define __BEGIN_DECLS extern "C" { 36 # define __END_DECLS } 37 #else 38 # define __BEGIN_DECLS /* empty */ 39 # define __END_DECLS /* empty */ 40 #endif 41 42 __BEGIN_DECLS 43 44 45 /* ======================================================================== 46 * Level 1 47 * ======================================================================== 48 */ 49 50 int gsl_blas_sdsdot (float alpha, 51 const gsl_vector_float * X, 52 const gsl_vector_float * Y, 53 float * result 54 ); 55 56 int gsl_blas_dsdot (const gsl_vector_float * X, 57 const gsl_vector_float * Y, 58 double * result 59 ); 60 61 int gsl_blas_sdot (const gsl_vector_float * X, 62 const gsl_vector_float * Y, 63 float * result 64 ); 65 66 int gsl_blas_ddot (const gsl_vector * X, 67 const gsl_vector * Y, 68 double * result 69 ); 70 71 72 int gsl_blas_cdotu (const gsl_vector_complex_float * X, 73 const gsl_vector_complex_float * Y, 74 gsl_complex_float * dotu); 75 76 int gsl_blas_cdotc (const gsl_vector_complex_float * X, 77 const gsl_vector_complex_float * Y, 78 gsl_complex_float * dotc); 79 80 int gsl_blas_zdotu (const gsl_vector_complex * X, 81 const gsl_vector_complex * Y, 82 gsl_complex * dotu); 83 84 int gsl_blas_zdotc (const gsl_vector_complex * X, 85 const gsl_vector_complex * Y, 86 gsl_complex * dotc); 87 88 89 float gsl_blas_snrm2 (const gsl_vector_float * X); 90 float gsl_blas_sasum (const gsl_vector_float * X); 91 double gsl_blas_dnrm2 (const gsl_vector * X); 92 double gsl_blas_dasum (const gsl_vector * X); 93 float gsl_blas_scnrm2 (const gsl_vector_complex_float * X); 94 float gsl_blas_scasum (const gsl_vector_complex_float * X); 95 double gsl_blas_dznrm2 (const gsl_vector_complex * X); 96 double gsl_blas_dzasum (const gsl_vector_complex * X); 97 98 99 CBLAS_INDEX_t gsl_blas_isamax (const gsl_vector_float * X); 100 CBLAS_INDEX_t gsl_blas_idamax (const gsl_vector * X); 101 CBLAS_INDEX_t gsl_blas_icamax (const gsl_vector_complex_float * X); 102 CBLAS_INDEX_t gsl_blas_izamax (const gsl_vector_complex * X); 103 104 105 int gsl_blas_sswap (gsl_vector_float * X, 106 gsl_vector_float * Y); 107 108 int gsl_blas_scopy (const gsl_vector_float * X, 109 gsl_vector_float * Y); 110 111 int gsl_blas_saxpy (float alpha, 112 const gsl_vector_float * X, 113 gsl_vector_float * Y); 114 115 int gsl_blas_dswap (gsl_vector * X, 116 gsl_vector * Y); 117 118 int gsl_blas_dcopy (const gsl_vector * X, 119 gsl_vector * Y); 120 121 int gsl_blas_daxpy (double alpha, 122 const gsl_vector * X, 123 gsl_vector * Y); 124 125 int gsl_blas_cswap (gsl_vector_complex_float * X, 126 gsl_vector_complex_float * Y); 127 128 int gsl_blas_ccopy (const gsl_vector_complex_float * X, 129 gsl_vector_complex_float * Y); 130 131 int gsl_blas_caxpy (const gsl_complex_float alpha, 132 const gsl_vector_complex_float * X, 133 gsl_vector_complex_float * Y); 134 135 int gsl_blas_zswap (gsl_vector_complex * X, 136 gsl_vector_complex * Y); 137 138 int gsl_blas_zcopy (const gsl_vector_complex * X, 139 gsl_vector_complex * Y); 140 141 int gsl_blas_zaxpy (const gsl_complex alpha, 142 const gsl_vector_complex * X, 143 gsl_vector_complex * Y); 144 145 146 int gsl_blas_srotg (float a[], float b[], float c[], float s[]); 147 148 int gsl_blas_srotmg (float d1[], float d2[], float b1[], float b2, float P[]); 149 150 int gsl_blas_srot (gsl_vector_float * X, 151 gsl_vector_float * Y, 152 float c, float s); 153 154 int gsl_blas_srotm (gsl_vector_float * X, 155 gsl_vector_float * Y, 156 const float P[]); 157 158 int gsl_blas_drotg (double a[], double b[], double c[], double s[]); 159 160 int gsl_blas_drotmg (double d1[], double d2[], double b1[], 161 double b2, double P[]); 162 163 int gsl_blas_drot (gsl_vector * X, 164 gsl_vector * Y, 165 const double c, const double s); 166 167 int gsl_blas_drotm (gsl_vector * X, 168 gsl_vector * Y, 169 const double P[]); 170 171 172 void gsl_blas_sscal (float alpha, gsl_vector_float * X); 173 void gsl_blas_dscal (double alpha, gsl_vector * X); 174 void gsl_blas_cscal (const gsl_complex_float alpha, gsl_vector_complex_float * X); 175 void gsl_blas_zscal (const gsl_complex alpha, gsl_vector_complex * X); 176 void gsl_blas_csscal (float alpha, gsl_vector_complex_float * X); 177 void gsl_blas_zdscal (double alpha, gsl_vector_complex * X); 178 179 180 /* =========================================================================== 181 * Level 2 182 * =========================================================================== 183 */ 184 185 /* 186 * Routines with standard 4 prefixes (S, D, C, Z) 187 */ 188 int gsl_blas_sgemv (CBLAS_TRANSPOSE_t TransA, 189 float alpha, 190 const gsl_matrix_float * A, 191 const gsl_vector_float * X, 192 float beta, 193 gsl_vector_float * Y); 194 195 int gsl_blas_strmv (CBLAS_UPLO_t Uplo, 196 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 197 const gsl_matrix_float * A, 198 gsl_vector_float * X); 199 200 int gsl_blas_strsv (CBLAS_UPLO_t Uplo, 201 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 202 const gsl_matrix_float * A, 203 gsl_vector_float * X); 204 205 int gsl_blas_dgemv (CBLAS_TRANSPOSE_t TransA, 206 double alpha, 207 const gsl_matrix * A, 208 const gsl_vector * X, 209 double beta, 210 gsl_vector * Y); 211 212 int gsl_blas_dtrmv (CBLAS_UPLO_t Uplo, 213 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 214 const gsl_matrix * A, 215 gsl_vector * X); 216 217 int gsl_blas_dtrsv (CBLAS_UPLO_t Uplo, 218 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 219 const gsl_matrix * A, 220 gsl_vector * X); 221 222 int gsl_blas_cgemv (CBLAS_TRANSPOSE_t TransA, 223 const gsl_complex_float alpha, 224 const gsl_matrix_complex_float * A, 225 const gsl_vector_complex_float * X, 226 const gsl_complex_float beta, 227 gsl_vector_complex_float * Y); 228 229 int gsl_blas_ctrmv (CBLAS_UPLO_t Uplo, 230 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 231 const gsl_matrix_complex_float * A, 232 gsl_vector_complex_float * X); 233 234 int gsl_blas_ctrsv (CBLAS_UPLO_t Uplo, 235 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 236 const gsl_matrix_complex_float * A, 237 gsl_vector_complex_float * X); 238 239 int gsl_blas_zgemv (CBLAS_TRANSPOSE_t TransA, 240 const gsl_complex alpha, 241 const gsl_matrix_complex * A, 242 const gsl_vector_complex * X, 243 const gsl_complex beta, 244 gsl_vector_complex * Y); 245 246 int gsl_blas_ztrmv (CBLAS_UPLO_t Uplo, 247 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 248 const gsl_matrix_complex * A, 249 gsl_vector_complex * X); 250 251 int gsl_blas_ztrsv (CBLAS_UPLO_t Uplo, 252 CBLAS_TRANSPOSE_t TransA, CBLAS_DIAG_t Diag, 253 const gsl_matrix_complex * A, 254 gsl_vector_complex *X); 255 256 /* 257 * Routines with S and D prefixes only 258 */ 259 int gsl_blas_ssymv (CBLAS_UPLO_t Uplo, 260 float alpha, 261 const gsl_matrix_float * A, 262 const gsl_vector_float * X, 263 float beta, 264 gsl_vector_float * Y); 265 266 int gsl_blas_sger (float alpha, 267 const gsl_vector_float * X, 268 const gsl_vector_float * Y, 269 gsl_matrix_float * A); 270 271 int gsl_blas_ssyr (CBLAS_UPLO_t Uplo, 272 float alpha, 273 const gsl_vector_float * X, 274 gsl_matrix_float * A); 275 276 int gsl_blas_ssyr2 (CBLAS_UPLO_t Uplo, 277 float alpha, 278 const gsl_vector_float * X, 279 const gsl_vector_float * Y, 280 gsl_matrix_float * A); 281 282 int gsl_blas_dsymv (CBLAS_UPLO_t Uplo, 283 double alpha, 284 const gsl_matrix * A, 285 const gsl_vector * X, 286 double beta, 287 gsl_vector * Y); 288 int gsl_blas_dger (double alpha, 289 const gsl_vector * X, 290 const gsl_vector * Y, 291 gsl_matrix * A); 292 293 int gsl_blas_dsyr (CBLAS_UPLO_t Uplo, 294 double alpha, 295 const gsl_vector * X, 296 gsl_matrix * A); 297 298 int gsl_blas_dsyr2 (CBLAS_UPLO_t Uplo, 299 double alpha, 300 const gsl_vector * X, 301 const gsl_vector * Y, 302 gsl_matrix * A); 303 304 /* 305 * Routines with C and Z prefixes only 306 */ 307 308 int gsl_blas_chemv (CBLAS_UPLO_t Uplo, 309 const gsl_complex_float alpha, 310 const gsl_matrix_complex_float * A, 311 const gsl_vector_complex_float * X, 312 const gsl_complex_float beta, 313 gsl_vector_complex_float * Y); 314 315 int gsl_blas_cgeru (const gsl_complex_float alpha, 316 const gsl_vector_complex_float * X, 317 const gsl_vector_complex_float * Y, 318 gsl_matrix_complex_float * A); 319 320 int gsl_blas_cgerc (const gsl_complex_float alpha, 321 const gsl_vector_complex_float * X, 322 const gsl_vector_complex_float * Y, 323 gsl_matrix_complex_float * A); 324 325 int gsl_blas_cher (CBLAS_UPLO_t Uplo, 326 float alpha, 327 const gsl_vector_complex_float * X, 328 gsl_matrix_complex_float * A); 329 330 int gsl_blas_cher2 (CBLAS_UPLO_t Uplo, 331 const gsl_complex_float alpha, 332 const gsl_vector_complex_float * X, 333 const gsl_vector_complex_float * Y, 334 gsl_matrix_complex_float * A); 335 336 int gsl_blas_zhemv (CBLAS_UPLO_t Uplo, 337 const gsl_complex alpha, 338 const gsl_matrix_complex * A, 339 const gsl_vector_complex * X, 340 const gsl_complex beta, 341 gsl_vector_complex * Y); 342 343 int gsl_blas_zgeru (const gsl_complex alpha, 344 const gsl_vector_complex * X, 345 const gsl_vector_complex * Y, 346 gsl_matrix_complex * A); 347 348 int gsl_blas_zgerc (const gsl_complex alpha, 349 const gsl_vector_complex * X, 350 const gsl_vector_complex * Y, 351 gsl_matrix_complex * A); 352 353 int gsl_blas_zher (CBLAS_UPLO_t Uplo, 354 double alpha, 355 const gsl_vector_complex * X, 356 gsl_matrix_complex * A); 357 358 int gsl_blas_zher2 (CBLAS_UPLO_t Uplo, 359 const gsl_complex alpha, 360 const gsl_vector_complex * X, 361 const gsl_vector_complex * Y, 362 gsl_matrix_complex * A); 363 364 /* 365 * =========================================================================== 366 * Prototypes for level 3 BLAS 367 * =========================================================================== 368 */ 369 370 /* 371 * Routines with standard 4 prefixes (S, D, C, Z) 372 */ 373 int gsl_blas_sgemm (CBLAS_TRANSPOSE_t TransA, 374 CBLAS_TRANSPOSE_t TransB, 375 float alpha, 376 const gsl_matrix_float * A, 377 const gsl_matrix_float * B, 378 float beta, 379 gsl_matrix_float * C); 380 381 int gsl_blas_ssymm (CBLAS_SIDE_t Side, CBLAS_UPLO_t Uplo, 382 float alpha, 383 const gsl_matrix_float * A, 384 const gsl_matrix_float * B, 385 float beta, 386 gsl_matrix_float * C); 387 388 int gsl_blas_ssyrk (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, 389 float alpha, 390 const gsl_matrix_float * A, 391 float beta, 392 gsl_matrix_float * C); 393 394 int gsl_blas_ssyr2k (CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t Trans, 395 float alpha, 396 const gsl_matrix_float * A, 397 const gsl_matrix_float * B, 398 float beta, 399 gsl_matrix_float * C); 400 401 int gsl_blas_strmm (CBLAS_SIDE_t Side, 402 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 403 CBLAS_DIAG_t Diag, 404 float alpha, 405 const gsl_matrix_float * A, 406 gsl_matrix_float * B); 407 408 int gsl_blas_strsm (CBLAS_SIDE_t Side, 409 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 410 CBLAS_DIAG_t Diag, 411 float alpha, 412 const gsl_matrix_float * A, 413 gsl_matrix_float * B); 414 415 int gsl_blas_dgemm (CBLAS_TRANSPOSE_t TransA, 416 CBLAS_TRANSPOSE_t TransB, 417 double alpha, 418 const gsl_matrix * A, 419 const gsl_matrix * B, 420 double beta, 421 gsl_matrix * C); 422 423 int gsl_blas_dsymm (CBLAS_SIDE_t Side, 424 CBLAS_UPLO_t Uplo, 425 double alpha, 426 const gsl_matrix * A, 427 const gsl_matrix * B, 428 double beta, 429 gsl_matrix * C); 430 431 int gsl_blas_dsyrk (CBLAS_UPLO_t Uplo, 432 CBLAS_TRANSPOSE_t Trans, 433 double alpha, 434 const gsl_matrix * A, 435 double beta, 436 gsl_matrix * C); 437 438 int gsl_blas_dsyr2k (CBLAS_UPLO_t Uplo, 439 CBLAS_TRANSPOSE_t Trans, 440 double alpha, 441 const gsl_matrix * A, 442 const gsl_matrix * B, 443 double beta, 444 gsl_matrix * C); 445 446 int gsl_blas_dtrmm (CBLAS_SIDE_t Side, 447 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 448 CBLAS_DIAG_t Diag, 449 double alpha, 450 const gsl_matrix * A, 451 gsl_matrix * B); 452 453 int gsl_blas_dtrsm (CBLAS_SIDE_t Side, 454 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 455 CBLAS_DIAG_t Diag, 456 double alpha, 457 const gsl_matrix * A, 458 gsl_matrix * B); 459 460 int gsl_blas_cgemm (CBLAS_TRANSPOSE_t TransA, 461 CBLAS_TRANSPOSE_t TransB, 462 const gsl_complex_float alpha, 463 const gsl_matrix_complex_float * A, 464 const gsl_matrix_complex_float * B, 465 const gsl_complex_float beta, 466 gsl_matrix_complex_float * C); 467 468 int gsl_blas_csymm (CBLAS_SIDE_t Side, 469 CBLAS_UPLO_t Uplo, 470 const gsl_complex_float alpha, 471 const gsl_matrix_complex_float * A, 472 const gsl_matrix_complex_float * B, 473 const gsl_complex_float beta, 474 gsl_matrix_complex_float * C); 475 476 int gsl_blas_csyrk (CBLAS_UPLO_t Uplo, 477 CBLAS_TRANSPOSE_t Trans, 478 const gsl_complex_float alpha, 479 const gsl_matrix_complex_float * A, 480 const gsl_complex_float beta, 481 gsl_matrix_complex_float * C); 482 483 int gsl_blas_csyr2k (CBLAS_UPLO_t Uplo, 484 CBLAS_TRANSPOSE_t Trans, 485 const gsl_complex_float alpha, 486 const gsl_matrix_complex_float * A, 487 const gsl_matrix_complex_float * B, 488 const gsl_complex_float beta, 489 gsl_matrix_complex_float * C); 490 491 int gsl_blas_ctrmm (CBLAS_SIDE_t Side, 492 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 493 CBLAS_DIAG_t Diag, 494 const gsl_complex_float alpha, 495 const gsl_matrix_complex_float * A, 496 gsl_matrix_complex_float * B); 497 498 int gsl_blas_ctrsm (CBLAS_SIDE_t Side, 499 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 500 CBLAS_DIAG_t Diag, 501 const gsl_complex_float alpha, 502 const gsl_matrix_complex_float * A, 503 gsl_matrix_complex_float * B); 504 505 int gsl_blas_zgemm (CBLAS_TRANSPOSE_t TransA, 506 CBLAS_TRANSPOSE_t TransB, 507 const gsl_complex alpha, 508 const gsl_matrix_complex * A, 509 const gsl_matrix_complex * B, 510 const gsl_complex beta, 511 gsl_matrix_complex * C); 512 513 int gsl_blas_zsymm (CBLAS_SIDE_t Side, 514 CBLAS_UPLO_t Uplo, 515 const gsl_complex alpha, 516 const gsl_matrix_complex * A, 517 const gsl_matrix_complex * B, 518 const gsl_complex beta, 519 gsl_matrix_complex * C); 520 521 int gsl_blas_zsyrk (CBLAS_UPLO_t Uplo, 522 CBLAS_TRANSPOSE_t Trans, 523 const gsl_complex alpha, 524 const gsl_matrix_complex * A, 525 const gsl_complex beta, 526 gsl_matrix_complex * C); 527 528 int gsl_blas_zsyr2k (CBLAS_UPLO_t Uplo, 529 CBLAS_TRANSPOSE_t Trans, 530 const gsl_complex alpha, 531 const gsl_matrix_complex * A, 532 const gsl_matrix_complex * B, 533 const gsl_complex beta, 534 gsl_matrix_complex *C); 535 536 int gsl_blas_ztrmm (CBLAS_SIDE_t Side, 537 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 538 CBLAS_DIAG_t Diag, 539 const gsl_complex alpha, 540 const gsl_matrix_complex * A, 541 gsl_matrix_complex * B); 542 543 int gsl_blas_ztrsm (CBLAS_SIDE_t Side, 544 CBLAS_UPLO_t Uplo, CBLAS_TRANSPOSE_t TransA, 545 CBLAS_DIAG_t Diag, 546 const gsl_complex alpha, 547 const gsl_matrix_complex * A, 548 gsl_matrix_complex * B); 549 550 /* 551 * Routines with prefixes C and Z only 552 */ 553 int gsl_blas_chemm (CBLAS_SIDE_t Side, 554 CBLAS_UPLO_t Uplo, 555 const gsl_complex_float alpha, 556 const gsl_matrix_complex_float * A, 557 const gsl_matrix_complex_float * B, 558 const gsl_complex_float beta, 559 gsl_matrix_complex_float * C); 560 561 int gsl_blas_cherk (CBLAS_UPLO_t Uplo, 562 CBLAS_TRANSPOSE_t Trans, 563 float alpha, 564 const gsl_matrix_complex_float * A, 565 float beta, 566 gsl_matrix_complex_float * C); 567 568 int gsl_blas_cher2k (CBLAS_UPLO_t Uplo, 569 CBLAS_TRANSPOSE_t Trans, 570 const gsl_complex_float alpha, 571 const gsl_matrix_complex_float * A, 572 const gsl_matrix_complex_float * B, 573 float beta, 574 gsl_matrix_complex_float * C); 575 576 int gsl_blas_zhemm (CBLAS_SIDE_t Side, 577 CBLAS_UPLO_t Uplo, 578 const gsl_complex alpha, 579 const gsl_matrix_complex * A, 580 const gsl_matrix_complex * B, 581 const gsl_complex beta, 582 gsl_matrix_complex * C); 583 584 int gsl_blas_zherk (CBLAS_UPLO_t Uplo, 585 CBLAS_TRANSPOSE_t Trans, 586 double alpha, 587 const gsl_matrix_complex * A, 588 double beta, 589 gsl_matrix_complex * C); 590 591 int gsl_blas_zher2k (CBLAS_UPLO_t Uplo, 592 CBLAS_TRANSPOSE_t Trans, 593 const gsl_complex alpha, 594 const gsl_matrix_complex * A, 595 const gsl_matrix_complex * B, 596 double beta, 597 gsl_matrix_complex * C); 598 599 600 __END_DECLS 601 602 #endif /* __GSL_BLAS_H__ */ 603