Actual source code: svdmat.c
1: /*
2: SVD routines for accessing the problem matrix.
4: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5: SLEPc - Scalable Library for Eigenvalue Problem Computations
6: Copyright (c) 2002-2007, Universidad Politecnica de Valencia, Spain
8: This file is part of SLEPc. See the README file for conditions of use
9: and additional information.
10: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
11: */
13: #include src/svd/svdimpl.h
17: PetscErrorCode SVDMatMult(SVD svd,PetscTruth trans,Vec x,Vec y)
18: {
25: svd->matvecs++;
26: if (trans) {
27: if (svd->AT) {
28: MatMult(svd->AT,x,y);
29: } else {
30: MatMultTranspose(svd->A,x,y);
31: }
32: } else {
33: if (svd->A) {
34: MatMult(svd->A,x,y);
35: } else {
36: MatMultTranspose(svd->AT,x,y);
37: }
38: }
39: return(0);
40: }
44: PetscErrorCode SVDMatGetVecs(SVD svd,Vec *x,Vec *y)
45: {
50: if (svd->A) {
51: MatGetVecs(svd->A,x,y);
52: } else {
53: MatGetVecs(svd->AT,y,x);
54: }
55: return(0);
56: }
60: PetscErrorCode SVDMatGetSize(SVD svd,PetscInt *m,PetscInt *n)
61: {
66: if (svd->A) {
67: MatGetSize(svd->A,m,n);
68: } else {
69: MatGetSize(svd->AT,n,m);
70: }
71: return(0);
72: }
76: PetscErrorCode SVDMatGetLocalSize(SVD svd,PetscInt *m,PetscInt *n)
77: {
82: if (svd->A) {
83: MatGetLocalSize(svd->A,m,n);
84: } else {
85: MatGetLocalSize(svd->AT,n,m);
86: }
87: return(0);
88: }