1 /* A2.h */ 2 3 #include "../cfiles.h" 4 #include "../SPOOLES.h" 5 #include "../ZV.h" 6 #include "../IV.h" 7 #include "../DV.h" 8 9 /*====================================================================*/ 10 /* 11 ----------------------------------------------------------- 12 the A2 structure holds a 2-d dense array of double complex 13 14 type -- type of entries 15 1 -- real 16 2 -- complex 17 n1 -- number of rows (first dimension) 18 n2 -- number of columns (second dimension) 19 inc1 -- 20 increment in storage along first dimension, 21 when inc1 == 1, the storage is column major 22 inc2 -- 23 increment in storage along second dimension, 24 when inc2 == 1, the storage is row major 25 nowned -- number of owned entries starting at entries 26 when > 0, storage pointed to by entries 27 has been allocated here and can be free'd. 28 when = 0, storage pointed to by entries 29 has not been allocated here and cannot be free'd. 30 entries -- base address for the entries 31 32 if real then 33 entry(i,j) is found in entries[i*inc1 + j*inc2] 34 else 35 entry(i,j) is found in entries[2*(i*inc1 + j*inc2)] 36 and entries[2*(i*inc1 + j*inc2)+1] 37 endif 38 ----------------------------------------------------------- 39 */ 40 typedef 41 struct _A2 { 42 int type ; 43 int n1 ; 44 int n2 ; 45 int inc1 ; 46 int inc2 ; 47 int nowned ; 48 double *entries ; 49 } A2 ; 50 51 #define A2_IS_REAL(chv) ((chv)->type == SPOOLES_REAL) 52 #define A2_IS_COMPLEX(chv) ((chv)->type == SPOOLES_COMPLEX) 53 54 #define A2_STRICT_LOWER 1 55 #define A2_LOWER 2 56 #define A2_DIAGONAL 3 57 #define A2_UPPER 4 58 #define A2_STRICT_UPPER 5 59 #define A2_ALL_ENTRIES 6 60 61 #define A2_BY_ROWS 0 62 #define A2_BY_COLUMNS 1 63 64 /*====================================================================*/ 65 /* 66 ------------------------------------------------------------------------ 67 ----- methods found in basics.c ---------------------------------------- 68 ------------------------------------------------------------------------ 69 */ 70 /* 71 ----------------------- 72 simplest constructor 73 74 created -- 98may01, cca 75 ----------------------- 76 */ 77 A2 * 78 A2_new ( 79 void 80 ) ; 81 /* 82 ----------------------- 83 set the default fields 84 85 created -- 98may01, cca 86 ----------------------- 87 */ 88 void 89 A2_setDefaultFields ( 90 A2 *mtx 91 ) ; 92 /* 93 -------------------------------------------------- 94 clear the data fields, releasing allocated storage 95 96 created -- 98may01, cca 97 -------------------------------------------------- 98 */ 99 void 100 A2_clearData ( 101 A2 *mtx 102 ) ; 103 /* 104 ------------------------------------------ 105 destructor, free's the object and its data 106 107 created -- 98may01, cca 108 ------------------------------------------ 109 */ 110 void 111 A2_free ( 112 A2 *mtx 113 ) ; 114 /* 115 ------------------------------------------------------------------------ 116 ----- methods found in instance.c -------------------------------------- 117 ------------------------------------------------------------------------ 118 */ 119 /* 120 -------------------------------------- 121 return the number of rows in the array 122 123 created -- 98may01, cca 124 -------------------------------------- 125 */ 126 int 127 A2_nrow ( 128 A2 *mtx 129 ) ; 130 /* 131 ----------------------------------------- 132 return the number of columns in the array 133 134 created -- 98may01, cca 135 ----------------------------------------- 136 */ 137 int 138 A2_ncol ( 139 A2 *mtx 140 ) ; 141 /* 142 -------------------------- 143 return the first increment 144 145 created -- 98may01, cca 146 -------------------------- 147 */ 148 int 149 A2_inc1 ( 150 A2 *mtx 151 ) ; 152 /* 153 --------------------------- 154 return the second increment 155 156 created -- 98may01, cca 157 --------------------------- 158 */ 159 int 160 A2_inc2 ( 161 A2 *mtx 162 ) ; 163 /* 164 ------------------------------- 165 return a pointer to the entries 166 167 created -- 98may01, cca 168 ------------------------------- 169 */ 170 double * 171 A2_entries ( 172 A2 *mtx 173 ) ; 174 /* 175 -------------------------------------------- 176 return a pointer to the first entry in a row 177 178 created -- 98may01, cca 179 -------------------------------------------- 180 */ 181 double * 182 A2_row ( 183 A2 *mtx, 184 int irow 185 ) ; 186 /* 187 ----------------------------------------------- 188 return a pointer to the first entry in a column 189 190 created -- 98may01, cca 191 ----------------------------------------------- 192 */ 193 double * 194 A2_column ( 195 A2 *mtx, 196 int jcol 197 ) ; 198 /* 199 ------------------------------------------- 200 fill *pValue with the entry in (irow, jcol) 201 202 created -- 98may01, cca 203 ------------------------------------------- 204 */ 205 void 206 A2_realEntry ( 207 A2 *mtx, 208 int irow, 209 int jcol, 210 double *pValue 211 ) ; 212 /* 213 --------------------------------------------------- 214 fill (*pReal,*pImag) with the entry in (irow, jcol) 215 216 created -- 98may01, cca 217 --------------------------------------------------- 218 */ 219 void 220 A2_complexEntry ( 221 A2 *mtx, 222 int irow, 223 int jcol, 224 double *pReal, 225 double *pImag 226 ) ; 227 /* 228 ----------------------------------------- 229 set the entry in (irow, jcol) to be value 230 231 created -- 98may01, cca 232 ----------------------------------------- 233 */ 234 void 235 A2_setRealEntry ( 236 A2 *mtx, 237 int irow, 238 int jcol, 239 double value 240 ) ; 241 /* 242 ----------------------------------------------- 243 set the entry in (irow, jcol) to be (real,imag) 244 245 created -- 98may01, cca 246 ----------------------------------------------- 247 */ 248 void 249 A2_setComplexEntry ( 250 A2 *mtx, 251 int irow, 252 int jcol, 253 double real, 254 double imag 255 ) ; 256 /* 257 --------------------------------------- 258 fill pointers to the matrix first entry 259 in row irow and column jcol 260 261 created -- 98may01, cca 262 --------------------------------------- 263 */ 264 void 265 A2_pointerToRealEntry ( 266 A2 *mtx, 267 int irow, 268 int jcol, 269 double **ppValue 270 ) ; 271 /* 272 --------------------------------------- 273 fill pointers to the matrix first entry 274 in row irow and column jcol 275 276 created -- 98may01, cca 277 --------------------------------------- 278 */ 279 void 280 A2_pointerToComplexEntry ( 281 A2 *mtx, 282 int irow, 283 int jcol, 284 double **ppReal, 285 double **ppImag 286 ) ; 287 /* 288 ------------------------------------------------------------------------ 289 ----- methods found in init.c ------------------------------------------ 290 ------------------------------------------------------------------------ 291 */ 292 /* 293 ------------------------------------------------------------------ 294 initializer. sets the n1, n2, inc1 and inc2 fields. 295 must have 296 mtx != NULL 297 type = SPOOLES_REAL or SPOOLES_COMPLEX 298 n1, n2, inc1, inc2 > 0 299 (inc1 = 1 and inc2 = nrow) or (inc1 = ncol and inc2 = 1) 300 301 if entries is NULL then 302 entries are allocated and zeroed. 303 else 304 mtx->nowned is set to 0 305 mtx->entries is set to entries. 306 endif 307 n1, n2, inc1, inc2 set 308 309 created -- 98apr15, cca 310 ------------------------------------------------------------------ 311 */ 312 void 313 A2_init ( 314 A2 *mtx, 315 int type, 316 int n1, 317 int n2, 318 int inc1, 319 int inc2, 320 double *entries 321 ) ; 322 /* 323 -------------------------------------------------- 324 submatrix initializer 325 326 A(0:lastrow-firstrow,0:lastcol-firstcol) 327 = B(firstrow:lastrow, firstcol:lastcol) 328 329 created -- 98apr15, cca 330 -------------------------------------------------- 331 */ 332 void 333 A2_subA2 ( 334 A2 *mtxA, 335 A2 *mtxB, 336 int firstrow, 337 int lastrow, 338 int firstcol, 339 int lastcol 340 ) ; 341 /* 342 ------------------------------------------------------------------------ 343 ----- methods found in norms.c ----------------------------------------- 344 ------------------------------------------------------------------------ 345 */ 346 /* 347 ------------------------------------- 348 return the entry of maximum magnitude 349 350 created -- 98apr15, cca 351 ------------------------------------- 352 */ 353 double 354 A2_maxabs ( 355 A2 *a 356 ) ; 357 /* 358 --------------------------------------- 359 return the frobenius norm of the matrix 360 361 created -- 98apr15, cca 362 --------------------------------------- 363 */ 364 double 365 A2_frobNorm ( 366 A2 *mtx 367 ) ; 368 /* 369 --------------------------------- 370 return the one-norm of the matrix 371 372 created -- 98apr15, cca 373 --------------------------------- 374 */ 375 double 376 A2_oneNorm ( 377 A2 *mtx 378 ) ; 379 /* 380 -------------------------------------- 381 return the infinity-norm of the matrix 382 383 created -- 98apr15, cca 384 -------------------------------------- 385 */ 386 double 387 A2_infinityNorm ( 388 A2 *mtx 389 ) ; 390 /* 391 ---------------------------------- 392 return the one-norm of column jcol 393 394 created -- 98apr15, cca 395 ---------------------------------- 396 */ 397 double 398 A2_oneNormOfColumn ( 399 A2 *mtx, 400 int jcol 401 ) ; 402 /* 403 ---------------------------------- 404 return the two-norm of column jcol 405 406 created -- 98apr15, cca 407 ---------------------------------- 408 */ 409 double 410 A2_twoNormOfColumn ( 411 A2 *mtx, 412 int jcol 413 ) ; 414 /* 415 --------------------------------------- 416 return the infinity-norm of column jcol 417 418 created -- 98apr15, cca 419 --------------------------------------- 420 */ 421 double 422 A2_infinityNormOfColumn ( 423 A2 *mtx, 424 int jcol 425 ) ; 426 /* 427 ------------------------------- 428 return the one-norm of row irow 429 430 created -- 98apr15, cca 431 ------------------------------- 432 */ 433 double 434 A2_oneNormOfRow ( 435 A2 *mtx, 436 int irow 437 ) ; 438 /* 439 ------------------------------- 440 return the two-norm of row irow 441 442 created -- 98apr15, cca 443 ------------------------------- 444 */ 445 double 446 A2_twoNormOfRow ( 447 A2 *mtx, 448 int irow 449 ) ; 450 /* 451 ------------------------------------ 452 return the infinity-norm of row irow 453 454 created -- 98apr15, cca 455 ------------------------------------ 456 */ 457 double 458 A2_infinityNormOfRow ( 459 A2 *mtx, 460 int irow 461 ) ; 462 /* 463 ------------------------------------------------------------------------ 464 ----- methods found in sort.c ------------------------------------------ 465 ------------------------------------------------------------------------ 466 */ 467 /* 468 ----------------------------------------- 469 permute the rows of the matrix 470 A(*,*) = A(index(*),*) 471 this method calls A2_sortRowsUp 472 but does not overwrite the index[] vector 473 474 created -- 98apr15, cca 475 ----------------------------------------- 476 */ 477 void 478 A2_permuteRows ( 479 A2 *mtx, 480 int nrow, 481 int index[] 482 ) ; 483 /* 484 ----------------------------------------- 485 permute the columns of the matrix 486 A(*,*) = A(*,index(*)) 487 this method calls A2_sortColumnsUp 488 but does not overwrite the index[] vector 489 490 created -- 98apr15, cca 491 ----------------------------------------- 492 */ 493 void 494 A2_permuteColumns ( 495 A2 *mtx, 496 int ncol, 497 int index[] 498 ) ; 499 /* 500 ---------------------------------------------- 501 sort the rows of the matrix in ascending order 502 of the rowids[] vector. on return, rowids is 503 in asending order. return value is the number 504 of row swaps made. 505 506 created -- 98apr15, cca 507 ---------------------------------------------- 508 */ 509 int 510 A2_sortRowsUp ( 511 A2 *mtx, 512 int nrow, 513 int rowids[] 514 ) ; 515 /* 516 ------------------------------------------------- 517 sort the columns of the matrix in ascending order 518 of the colids[] vector. on return, colids is 519 in asending order. return value is the number 520 of column swaps made. 521 522 created -- 98apr15, cca 523 ------------------------------------------------- 524 */ 525 int 526 A2_sortColumnsUp ( 527 A2 *mtx, 528 int ncol, 529 int colids[] 530 ) ; 531 /* 532 ------------------------------------------------------------------------ 533 ----- methods found in QRreduce.c -------------------------------------- 534 ------------------------------------------------------------------------ 535 */ 536 /* 537 -------------------------------------------------------------- 538 purpose -- compute A = QR, where Q is a product of householder 539 vectors, (I - beta_j v_j v_j^T). on return, v_j is 540 found in the lower triangle of A, v_j(j) = 1.0. 541 542 return value -- # of floating point operations 543 544 created -- 98may25, cca 545 -------------------------------------------------------------- 546 */ 547 double 548 A2_QRreduce ( 549 A2 *mtxA, 550 DV *workDV, 551 int msglvl, 552 FILE *msgFile 553 ) ; 554 /* 555 ----------------------------------------------------------- 556 A contains the following data from the A = QR factorization 557 558 A(1:ncolA,1:ncolA) = R 559 A(j+1:nrowA,j) is v_j, the j-th householder vector, 560 where v_j[j] = 1.0 561 562 NOTE: A and Q must be column major 563 564 created -- 98dec10, cca 565 ----------------------------------------------------------- 566 */ 567 void 568 A2_computeQ ( 569 A2 *Q, 570 A2 *A, 571 DV *workDV, 572 int msglvl, 573 FILE *msgFile 574 ) ; 575 /* 576 ----------------------------------------------------------- 577 A contains the following data from the A = QR factorization 578 579 A(1:ncolA,1:ncolA) = R 580 A(j+1:nrowA,j) is v_j, the j-th householder vector, 581 where v_j[j] = 1.0 582 583 we compute Y = Q^T X when A is real 584 and Y = Q^H X when A is complex 585 586 NOTE: A, Y and X must be column major. 587 NOTE: Y and X can be the same object, 588 in which case X is overwritten with Y 589 590 created -- 98dec10, cca 591 ----------------------------------------------------------- 592 */ 593 void 594 A2_applyQT ( 595 A2 *Y, 596 A2 *A, 597 A2 *X, 598 DV *workDV, 599 int msglvl, 600 FILE *msgFile 601 ) ; 602 /* 603 ------------------------------------------------------------------------ 604 ----- methods found in copyEntriesToVector.c --------------------------- 605 ------------------------------------------------------------------------ 606 */ 607 /* 608 ---------------------------------------------------------------- 609 purpose -- copy entries to a vector. the portion copied 610 can be a union of the strict lower portion, 611 the diagonal portion, and the strict upper 612 portion. there is one restriction, if the strict 613 lower and strict upper are to be copied, the 614 diagonal will also be copied. 615 616 length -- length of dvec[] 617 dvec[] -- vector to receive matrix entries 618 copyflag -- flag to denote what part of the entries to move 619 A2_STRICT_LOWER --> move strict lower entries 620 A2_LOWER --> move lower entries (includes the diagonal) 621 A2_DIAGONAL --> move diagonal entries 622 A2_UPPER --> move upper entries (includes the diagonal) 623 A2_STRICT_UPPER --> move strict upper entries 624 A2_ALL_ENTRIES --> move all entries 625 storeflag -- flag to denote how to store entries in dvec[] 626 A2_BY_ROWS --> store by rows 627 A2_BY_COLUMNS --> store by columns 628 629 return value -- number of entries copied 630 631 created -- 97jun03, cca, dkw 632 modified -- 98may25, cca 633 ---------------------------------------------------------------- 634 */ 635 int 636 A2_copyEntriesToVector ( 637 A2 *mtx, 638 int length, 639 double *dvec, 640 int copyflag, 641 int storeflag 642 ) ; 643 /* 644 ------------------------------------------------------------------------ 645 ----- methods found in makeStaircase.c --------------------------------- 646 ------------------------------------------------------------------------ 647 */ 648 /* 649 ----------------------------------------------------------------- 650 purpose -- to permute the rows so the matrix is in staircase form 651 652 created -- 98may25, cca 653 ----------------------------------------------------------------- 654 */ 655 void 656 A2_makeStaircase ( 657 A2 *mtxA 658 ) ; 659 /* 660 ------------------------------------------------------------------------ 661 ----- methods found in util.c ------------------------------------------ 662 ------------------------------------------------------------------------ 663 */ 664 /* 665 ---------------------------------------------- 666 return the number of bytes taken by the object 667 668 created -- 98may01, cca 669 ---------------------------------------------- 670 */ 671 int 672 A2_sizeOf ( 673 A2 *mtx 674 ) ; 675 /* 676 --------------------------------------------------------------- 677 shift the base of the entries and adjust dimensions 678 679 mtx(0:n1-rowoff-1,0:n2-coloff-1) = mtx(rowoff:n1-1,coloff:n2-1) 680 681 created -- 98may01, cca 682 --------------------------------------------------------------- 683 */ 684 void 685 A2_shiftBase ( 686 A2 *mtx, 687 int rowoff, 688 int coloff 689 ) ; 690 /* 691 -------------------------------------------------------------- 692 returns 1 if the storage is row major, otherwise returns zero. 693 694 created -- 98may01, cca 695 -------------------------------------------------------------- 696 */ 697 int 698 A2_rowMajor ( 699 A2 *mtx 700 ) ; 701 /* 702 ----------------------------------------------------------------- 703 returns 1 if the storage is column major, otherwise returns zero. 704 705 created -- 98may01, cca 706 ----------------------------------------------------------------- 707 */ 708 int 709 A2_columnMajor ( 710 A2 *mtx 711 ) ; 712 /* 713 ----------------------- 714 transpose the matrix 715 716 created -- 98may01, cca 717 ----------------------- 718 */ 719 void 720 A2_transpose ( 721 A2 *mtx 722 ) ; 723 /* 724 ---------------------------- 725 extract row[*] = mtx(irow,*) 726 727 created -- 98may01, cca 728 ---------------------------- 729 */ 730 void 731 A2_extractRow ( 732 A2 *mtx, 733 double row[], 734 int irow 735 ) ; 736 /* 737 ---------------------------- 738 extract col[*] = mtx(*,jcol) 739 740 created -- 98may01, cca 741 ---------------------------- 742 */ 743 void 744 A2_extractColumn ( 745 A2 *mtx, 746 double col[], 747 int jcol 748 ) ; 749 /* 750 ----------------------- 751 set mtx(irow,*) = y[*] 752 753 created -- 98may01, cca 754 ----------------------- 755 */ 756 void 757 A2_setRow ( 758 A2 *mtx, 759 double row[], 760 int irow 761 ) ; 762 /* 763 ----------------------- 764 set mtx(*,jcol) = y[*] 765 766 created -- 98may01, cca 767 ----------------------- 768 */ 769 void 770 A2_setColumn ( 771 A2 *mtx, 772 double col[], 773 int jcol 774 ) ; 775 /* 776 ---------------------------- 777 extract row[*] = mtx(irow,*) 778 779 created -- 98may01, cca 780 ---------------------------- 781 */ 782 void 783 A2_extractRowDV ( 784 A2 *mtx, 785 DV *rowDV, 786 int irow 787 ) ; 788 /* 789 ---------------------------- 790 extract row[*] = mtx(irow,*) 791 792 created -- 98may01, cca 793 ---------------------------- 794 */ 795 void 796 A2_extractRowZV ( 797 A2 *mtx, 798 ZV *rowZV, 799 int irow 800 ) ; 801 /* 802 ---------------------------- 803 extract col[*] = mtx(*,jcol) 804 805 created -- 98may01, cca 806 ---------------------------- 807 */ 808 void 809 A2_extractColumnDV ( 810 A2 *mtx, 811 DV *colDV, 812 int jcol 813 ) ; 814 /* 815 ---------------------------- 816 extract col[*] = mtx(*,jcol) 817 818 created -- 98may01, cca 819 ---------------------------- 820 */ 821 void 822 A2_extractColumnZV ( 823 A2 *mtx, 824 ZV *colZV, 825 int jcol 826 ) ; 827 /* 828 ----------------------- 829 set mtx(irow,*) = y[*] 830 831 created -- 98may01, cca 832 ----------------------- 833 */ 834 void 835 A2_setRowDV ( 836 A2 *mtx, 837 DV *rowDV, 838 int irow 839 ) ; 840 /* 841 ----------------------- 842 set mtx(irow,*) = y[*] 843 844 created -- 98may01, cca 845 ----------------------- 846 */ 847 void 848 A2_setRowZV ( 849 A2 *mtx, 850 ZV *rowZV, 851 int irow 852 ) ; 853 /* 854 ----------------------- 855 set mtx(*,jcol) = y[*] 856 857 created -- 98may01, cca 858 ----------------------- 859 */ 860 void 861 A2_setColumnDV ( 862 A2 *mtx, 863 DV *colDV, 864 int jcol 865 ) ; 866 /* 867 ----------------------- 868 set mtx(*,jcol) = y[*] 869 870 created -- 98may01, cca 871 ----------------------- 872 */ 873 void 874 A2_setColumnZV ( 875 A2 *mtx, 876 ZV *colZV, 877 int jcol 878 ) ; 879 /* 880 ------------------------------------------------------------- 881 fill the matrix with uniform random numbers in [lower, upper] 882 883 created -- 98may01, cca 884 ------------------------------------------------------------- 885 */ 886 void 887 A2_fillRandomUniform ( 888 A2 *a, 889 double lower, 890 double upper, 891 int seed 892 ) ; 893 /* 894 ----------------------------------------------- 895 fill the matrix with normal(0,1) random numbers 896 897 created -- 98may01, cca 898 ----------------------------------------------- 899 */ 900 void 901 A2_fillRandomNormal ( 902 A2 *a, 903 double mean, 904 double variance, 905 int seed 906 ) ; 907 /* 908 ---------------------------------------- 909 fill the matrix with the identity matrix 910 911 created -- 98may01, cca 912 ---------------------------------------- 913 */ 914 void 915 A2_fillWithIdentity ( 916 A2 *a 917 ) ; 918 /* 919 -------------------------- 920 fill the matrix with zeros 921 922 created -- 98may01, cca 923 -------------------------- 924 */ 925 void 926 A2_zero ( 927 A2 *a 928 ) ; 929 /* 930 ---------------------------- 931 copy one matrix into another 932 A := B 933 934 created -- 98may01, cca 935 ---------------------------- 936 */ 937 void 938 A2_copy ( 939 A2 *A, 940 A2 *B 941 ) ; 942 /* 943 -------------------------------- 944 subtract one matrix from another 945 946 A := A - B 947 948 created -- 98may01, cca 949 ---------------------------- 950 */ 951 void 952 A2_sub ( 953 A2 *A, 954 A2 *B 955 ) ; 956 /* 957 --------------------------- 958 swap two rows of the matrix 959 960 created -- 98may01, cca 961 --------------------------- 962 */ 963 void 964 A2_swapRows ( 965 A2 *a, 966 int irow1, 967 int irow2 968 ) ; 969 /* 970 ------------------------------ 971 swap two columns of the matrix 972 973 created -- 98may01, cca 974 ------------------------------ 975 */ 976 void 977 A2_swapColumns ( 978 A2 *a, 979 int jcol1, 980 int jcol2 981 ) ; 982 /* 983 ------------------------------------------------------------------------ 984 ----- methods found in IO.c -------------------------------------------- 985 ------------------------------------------------------------------------ 986 */ 987 /* 988 -------------------------------------------- 989 purpose -- to read in the object from a file 990 991 input -- 992 993 fn -- filename, must be *.a2b or *.a2f 994 995 return value -- 1 if success, 0 if failure 996 997 created -- 98may01, cca 998 -------------------------------------------- 999 */ 1000 int 1001 A2_readFromFile ( 1002 A2 *mtx, 1003 char *fn 1004 ) ; 1005 /* 1006 -------------------------------------------------- 1007 purpose -- to read an object from a formatted file 1008 1009 return value -- 1 if success, 0 if failure 1010 1011 created -- 98may01, cca 1012 -------------------------------------------------- 1013 */ 1014 int 1015 A2_readFromFormattedFile ( 1016 A2 *mtx, 1017 FILE *fp 1018 ) ; 1019 /* 1020 ----------------------------------------------- 1021 purpose -- to read an object from a binary file 1022 1023 return value -- 1 if success, 0 if failure 1024 1025 created -- 98may01, cca 1026 ----------------------------------------------- 1027 */ 1028 int 1029 A2_readFromBinaryFile ( 1030 A2 *mtx, 1031 FILE *fp 1032 ) ; 1033 /* 1034 --------------------------------------- 1035 purpose -- to write an object to a file 1036 1037 input -- 1038 1039 fn -- filename 1040 *.a2b -- binary 1041 *.a2f -- formatted 1042 anything else -- for human eye 1043 1044 created -- 98may01, cca 1045 --------------------------------------- 1046 */ 1047 void 1048 A2_writeToFile ( 1049 A2 *mtx, 1050 char *fn 1051 ) ; 1052 /* 1053 ------------------------------------------------- 1054 purpose -- to write an object to a formatted file 1055 1056 created -- 98may01, cca 1057 ------------------------------------------------- 1058 */ 1059 void 1060 A2_writeToFormattedFile ( 1061 A2 *mtx, 1062 FILE *fp 1063 ) ; 1064 /* 1065 -------------------------------------------------------- 1066 purpose -- to write an adjacency object to a binary file 1067 1068 created -- 98may01, cca 1069 -------------------------------------------------------- 1070 */ 1071 void 1072 A2_writeToBinaryFile ( 1073 A2 *mtx, 1074 FILE *fp 1075 ) ; 1076 /* 1077 ---------------------------------------------- 1078 purpose -- to write the object for a human eye 1079 1080 created -- 98may01, cca 1081 ---------------------------------------------- 1082 */ 1083 void 1084 A2_writeForHumanEye ( 1085 A2 *mtx, 1086 FILE *fp 1087 ) ; 1088 /* 1089 -------------------------------------- 1090 purpose -- to write out the statistics 1091 1092 created -- 98may01, cca 1093 -------------------------------------- 1094 */ 1095 void 1096 A2_writeStats ( 1097 A2 *mtx, 1098 FILE *fp 1099 ) ; 1100 /* 1101 ----------------------------------------------- 1102 purpose -- to write the matrix in matlab format 1103 1104 created -- 98may01, cca 1105 ----------------------------------------------- 1106 */ 1107 void 1108 A2_writeForMatlab ( 1109 A2 *mtx, 1110 char *mtxname, 1111 FILE *fp 1112 ) ; 1113 /*====================================================================*/ 1114