| Line 110... |
Line 110... |
}
|
}
|
switch (svd->transmode) {
|
switch (svd->transmode) {
|
case SVD_TRANSPOSE_EXPLICIT:
|
case SVD_TRANSPOSE_EXPLICIT:
|
ierr = PetscViewerASCIIPrintf(viewer," transpose mode: explicit\n");CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPrintf(viewer," transpose mode: explicit\n");CHKERRQ(ierr);
|
break;
|
break;
|
case SVD_TRANSPOSE_MATMULT:
|
case SVD_TRANSPOSE_IMPLICIT:
|
ierr = PetscViewerASCIIPrintf(viewer," transpose mode: matmult\n");CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPrintf(viewer," transpose mode: implicit\n");CHKERRQ(ierr);
|
break;
|
break;
|
default:
|
default:
|
ierr = PetscViewerASCIIPrintf(viewer," transpose mode: not yet set\n");CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPrintf(viewer," transpose mode: not yet set\n");CHKERRQ(ierr);
|
}
|
}
|
|
if (svd->which == SVD_LARGEST) {
|
|
ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: largest\n");CHKERRQ(ierr);
|
|
} else {
|
|
ierr = PetscViewerASCIIPrintf(viewer," selected portion of the spectrum: smallest\n");CHKERRQ(ierr);
|
|
}
|
|
ierr = PetscViewerASCIIPrintf(viewer," number of singular values (nsv): %d\n",svd->nsv);CHKERRQ(ierr);
|
|
ierr = PetscViewerASCIIPrintf(viewer," number of column vectors (ncv): %d\n",svd->ncv);CHKERRQ(ierr);
|
|
ierr = PetscViewerASCIIPrintf(viewer," maximum number of iterations: %d\n",svd->max_it);
|
|
ierr = PetscViewerASCIIPrintf(viewer," tolerance: %g\n",svd->tol);CHKERRQ(ierr);
|
if (svd->ops->view) {
|
if (svd->ops->view) {
|
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
|
ierr = (*svd->ops->view)(svd,viewer);CHKERRQ(ierr);
|
ierr = (*svd->ops->view)(svd,viewer);CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
|
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
|
}
|
}
|
| Line 175... |
Line 184... |
ierr = PetscMemzero(svd->ops,sizeof(struct _SVDOps));CHKERRQ(ierr);
|
ierr = PetscMemzero(svd->ops,sizeof(struct _SVDOps));CHKERRQ(ierr);
|
|
|
svd->type_name = PETSC_NULL;
|
svd->type_name = PETSC_NULL;
|
svd->A = PETSC_NULL;
|
svd->A = PETSC_NULL;
|
svd->AT = PETSC_NULL;
|
svd->AT = PETSC_NULL;
|
svd->transmode = PETSC_DEFAULT;
|
svd->transmode = PETSC_DECIDE;
|
svd->sigma = PETSC_NULL;
|
svd->sigma = PETSC_NULL;
|
svd->U = PETSC_NULL;
|
svd->U = PETSC_NULL;
|
svd->V = PETSC_NULL;
|
svd->V = PETSC_NULL;
|
svd->vec_initial = PETSC_NULL;
|
svd->vec_initial = PETSC_NULL;
|
svd->which = SVD_LARGEST;
|
svd->which = SVD_LARGEST;
|
svd->n = 0;
|
svd->n = 0;
|
svd->nconv = -1;
|
svd->nconv = 0;
|
svd->nsv = 1;
|
svd->nsv = 1;
|
svd->ncv = PETSC_DECIDE;
|
svd->ncv = PETSC_DECIDE;
|
svd->max_it = PETSC_DEFAULT;
|
svd->its = 0;
|
|
svd->max_it = PETSC_DECIDE;
|
svd->tol = 1e-7;
|
svd->tol = 1e-7;
|
svd->data = PETSC_NULL;
|
svd->data = PETSC_NULL;
|
svd->setupcalled = 0;
|
svd->setupcalled = 0;
|
|
svd->reason = SVD_CONVERGED_ITERATING;
|
|
|
ierr = PetscPublishAll(svd);CHKERRQ(ierr);
|
ierr = PetscPublishAll(svd);CHKERRQ(ierr);
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
| Line 224... |
Line 235... |
|
|
if (svd->ops->destroy) {
|
if (svd->ops->destroy) {
|
ierr = (*svd->ops->destroy)(svd); CHKERRQ(ierr);
|
ierr = (*svd->ops->destroy)(svd); CHKERRQ(ierr);
|
}
|
}
|
|
|
if (svd->A) { ierr = MatDestroy(svd->A);CHKERRQ(ierr); }
|
if (svd->A) { ierr = MatDestroy(svd->A);CHKERRQ(ierr); }
|
if (svd->AT) { ierr = MatDestroy(svd->AT);CHKERRQ(ierr); }
|
if (svd->AT) { ierr = MatDestroy(svd->AT);CHKERRQ(ierr); }
|
if (svd->n) {
|
if (svd->n) {
|
ierr = PetscFree(svd->sigma);CHKERRQ(ierr);
|
ierr = PetscFree(svd->sigma);CHKERRQ(ierr);
|
for (i=0;i<svd->n;i++) {
|
for (i=0;i<svd->n;i++) {
|
ierr = VecDestroy(svd->U[i]); CHKERRQ(ierr);
|
ierr = VecDestroy(svd->U[i]); CHKERRQ(ierr);
|
}
|
}
|
| Line 237... |
Line 248... |
for (i=0;i<svd->n;i++) {
|
for (i=0;i<svd->n;i++) {
|
ierr = VecDestroy(svd->V[i]);CHKERRQ(ierr);
|
ierr = VecDestroy(svd->V[i]);CHKERRQ(ierr);
|
}
|
}
|
ierr = PetscFree(svd->V);CHKERRQ(ierr);
|
ierr = PetscFree(svd->V);CHKERRQ(ierr);
|
}
|
}
|
if (svd->data) { ierr = PetscFree(svd->data);CHKERRQ(ierr); }
|
if (svd->vec_initial) { ierr = VecDestroy(svd->vec_initial);CHKERRQ(ierr); }
|
|
if (svd->data) { ierr = PetscFree(svd->data);CHKERRQ(ierr); }
|
|
|
PetscLogObjectDestroy(svd);
|
PetscLogObjectDestroy(svd);
|
PetscHeaderDestroy(svd);
|
PetscHeaderDestroy(svd);
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|