| dense.c (d636dbe3a9c413b447e52fc0f7f06f5e4018d190) | dense.c (d3e5ee8800a1fc69869e95d48ef2feb107aaa57d) |
|---|---|
| 1#ifndef lint | 1#ifndef lint |
| 2static char vcid[] = "$Id: dense.c,v 1.53 1995/09/04 17:24:37 bsmith Exp bsmith $"; | 2static char vcid[] = "$Id: dense.c,v 1.54 1995/09/06 03:05:24 bsmith Exp curfman $"; |
| 3#endif 4 5/* 6 Standard Fortran style matrices 7*/ 8#include "petsc.h" 9#include "pinclude/plapack.h" 10#include "matimpl.h" --- 399 unchanged lines hidden (view full) --- 410 PLogObjectDestroy(mat); 411 PETSCHEADERDESTROY(mat); 412 return 0; 413} 414 415static int MatTranspose_Dense(Mat matin,Mat *matout) 416{ 417 Mat_Dense *mat = (Mat_Dense *) matin->data; | 3#endif 4 5/* 6 Standard Fortran style matrices 7*/ 8#include "petsc.h" 9#include "pinclude/plapack.h" 10#include "matimpl.h" --- 399 unchanged lines hidden (view full) --- 410 PLogObjectDestroy(mat); 411 PETSCHEADERDESTROY(mat); 412 return 0; 413} 414 415static int MatTranspose_Dense(Mat matin,Mat *matout) 416{ 417 Mat_Dense *mat = (Mat_Dense *) matin->data; |
| 418 int k,j; 419 Scalar *v = mat->v, tmp; | 418 int k, j, m, n; 419 Scalar *v, tmp; |
| 420 | 420 |
| 421 v = mat->v; m = mat->m; n = mat->n; |
|
| 421 if (!matout) { /* in place transpose */ | 422 if (!matout) { /* in place transpose */ |
| 422 if (mat->m != mat->n) { 423 SETERRQ(1,"MatTranspose_Dense:Cannot transpose rectangular matrix"); 424 } 425 for ( j=0; j<mat->m; j++ ) { | 423 if (m != n) SETERRQ(1, 424 "MatTranspose_Dense: Cannot transpose rectangular matrix in place"); 425 for ( j=0; j<m; j++ ) { |
| 426 for ( k=0; k<j; k++ ) { | 426 for ( k=0; k<j; k++ ) { |
| 427 tmp = v[j + k*mat->n]; 428 v[j + k*mat->n] = v[k + j*mat->n]; 429 v[k + j*mat->n] = tmp; | 427 tmp = v[j + k*n]; 428 v[j + k*n] = v[k + j*n]; 429 v[k + j*n] = tmp; |
| 430 } 431 } 432 } | 430 } 431 } 432 } |
| 433 else { 434 SETERRQ(1,"MatTranspose_Dense:not out of place transpose yet"); 435 } | 433 else { /* out-of-place transpose */ 434 int ierr; 435 Mat tmat; 436 Mat_Dense *tmatd; 437 Scalar *v2; 438 ierr = MatCreateSequentialDense(matin->comm,mat->n,mat->m,&tmat); CHKERRQ(ierr); 439 tmatd = (Mat_Dense *) tmat->data; 440 v = mat->v; v2 = tmatd->v; m = tmatd->m; n = tmatd->n; 441 for ( j=0; j<n; j++ ) { 442 for ( k=0; k<m; k++ ) { 443 v2[j + k*n] = v[k + j*m]; 444 } 445 } 446 ierr = MatAssemblyBegin(tmat,FINAL_ASSEMBLY); CHKERRQ(ierr); 447 ierr = MatAssemblyEnd(tmat,FINAL_ASSEMBLY); CHKERRQ(ierr); 448 *matout = tmat; 449 } |
| 436 return 0; 437} 438 439static int MatEqual_Dense(Mat matin1,Mat matin2) 440{ 441 Mat_Dense *mat1 = (Mat_Dense *) matin1->data; 442 Mat_Dense *mat2 = (Mat_Dense *) matin2->data; 443 int i; --- 101 unchanged lines hidden (view full) --- 545{ 546 Mat_Dense *aij = (Mat_Dense *) aijin->data; 547 if (op == ROW_ORIENTED) aij->roworiented = 1; 548 else if (op == COLUMN_ORIENTED) aij->roworiented = 0; 549 /* doesn't care about sorted rows or columns */ 550 return 0; 551} 552 | 450 return 0; 451} 452 453static int MatEqual_Dense(Mat matin1,Mat matin2) 454{ 455 Mat_Dense *mat1 = (Mat_Dense *) matin1->data; 456 Mat_Dense *mat2 = (Mat_Dense *) matin2->data; 457 int i; --- 101 unchanged lines hidden (view full) --- 559{ 560 Mat_Dense *aij = (Mat_Dense *) aijin->data; 561 if (op == ROW_ORIENTED) aij->roworiented = 1; 562 else if (op == COLUMN_ORIENTED) aij->roworiented = 0; 563 /* doesn't care about sorted rows or columns */ 564 return 0; 565} 566 |
| 553static int MatZero_Dense(Mat A) | 567static int MatZeroEntries_Dense(Mat A) |
| 554{ 555 Mat_Dense *l = (Mat_Dense *) A->data; 556 PETSCMEMSET(l->v,0,l->m*l->n*sizeof(Scalar)); 557 return 0; 558} 559 560static int MatZeroRows_Dense(Mat A,IS is,Scalar *diag) 561{ --- 18 unchanged lines hidden (view full) --- 580 581static int MatGetSize_Dense(Mat matin,int *m,int *n) 582{ 583 Mat_Dense *mat = (Mat_Dense *) matin->data; 584 *m = mat->m; *n = mat->n; 585 return 0; 586} 587 | 568{ 569 Mat_Dense *l = (Mat_Dense *) A->data; 570 PETSCMEMSET(l->v,0,l->m*l->n*sizeof(Scalar)); 571 return 0; 572} 573 574static int MatZeroRows_Dense(Mat A,IS is,Scalar *diag) 575{ --- 18 unchanged lines hidden (view full) --- 594 595static int MatGetSize_Dense(Mat matin,int *m,int *n) 596{ 597 Mat_Dense *mat = (Mat_Dense *) matin->data; 598 *m = mat->m; *n = mat->n; 599 return 0; 600} 601 |
| 602static int MatGetOwnershipRange_Dense(Mat matin,int *m,int *n) 603{ 604 Mat_Dense *mat = (Mat_Dense *) matin->data; 605 *m = 0; *n = mat->m; 606 return 0; 607} 608 |
|
| 588static int MatGetArray_Dense(Mat matin,Scalar **array) 589{ 590 Mat_Dense *mat = (Mat_Dense *) matin->data; 591 *array = mat->v; 592 return 0; 593} 594 595 --- 55 unchanged lines hidden (view full) --- 651 MatSolve_Dense,MatSolveAdd_Dense, 652 MatSolveTrans_Dense,MatSolveTransAdd_Dense, 653 MatLUFactor_Dense,MatCholeskyFactor_Dense, 654 MatRelax_Dense, 655 MatTranspose_Dense, 656 MatGetInfo_Dense,MatEqual_Dense, 657 MatGetDiagonal_Dense,MatScale_Dense,MatNorm_Dense, 658 0,0, | 609static int MatGetArray_Dense(Mat matin,Scalar **array) 610{ 611 Mat_Dense *mat = (Mat_Dense *) matin->data; 612 *array = mat->v; 613 return 0; 614} 615 616 --- 55 unchanged lines hidden (view full) --- 672 MatSolve_Dense,MatSolveAdd_Dense, 673 MatSolveTrans_Dense,MatSolveTransAdd_Dense, 674 MatLUFactor_Dense,MatCholeskyFactor_Dense, 675 MatRelax_Dense, 676 MatTranspose_Dense, 677 MatGetInfo_Dense,MatEqual_Dense, 678 MatGetDiagonal_Dense,MatScale_Dense,MatNorm_Dense, 679 0,0, |
| 659 0, MatSetOption_Dense,MatZero_Dense,MatZeroRows_Dense,0, | 680 0, MatSetOption_Dense,MatZeroEntries_Dense,MatZeroRows_Dense,0, |
| 660 MatLUFactorSymbolic_Dense,MatLUFactorNumeric_Dense, 661 MatCholeskyFactorSymbolic_Dense,MatCholeskyFactorNumeric_Dense, | 681 MatLUFactorSymbolic_Dense,MatLUFactorNumeric_Dense, 682 MatCholeskyFactorSymbolic_Dense,MatCholeskyFactorNumeric_Dense, |
| 662 MatGetSize_Dense,MatGetSize_Dense,0, | 683 MatGetSize_Dense,MatGetSize_Dense,MatGetOwnershipRange_Dense, |
| 663 0,0,MatGetArray_Dense,0,0, 664 MatGetSubMatrix_Dense,MatGetSubMatrixInPlace_Dense, 665 MatCopyPrivate_Dense}; 666 667/*@C 668 MatCreateSequentialDense - Creates a sequential dense matrix that 669 is stored in column major order (the usual Fortran 77 manner). Many 670 of the matrix operations use the BLAS and LAPACK routines. --- 45 unchanged lines hidden --- | 684 0,0,MatGetArray_Dense,0,0, 685 MatGetSubMatrix_Dense,MatGetSubMatrixInPlace_Dense, 686 MatCopyPrivate_Dense}; 687 688/*@C 689 MatCreateSequentialDense - Creates a sequential dense matrix that 690 is stored in column major order (the usual Fortran 77 manner). Many 691 of the matrix operations use the BLAS and LAPACK routines. --- 45 unchanged lines hidden --- |