| Line 41... |
Line 41... |
PetscErrorCode SVDSetOperator(SVD svd,Mat mat)
|
PetscErrorCode SVDSetOperator(SVD svd,Mat mat)
|
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(svd,SVD_COOKIE,1);
|
PetscValidHeaderSpecific(svd,SVD_CLASSID,1);
|
PetscValidHeaderSpecific(mat,MAT_COOKIE,2);
|
PetscValidHeaderSpecific(mat,MAT_CLASSID,2);
|
PetscCheckSameComm(svd,1,mat,2);
|
PetscCheckSameComm(svd,1,mat,2);
|
ierr = PetscObjectReference((PetscObject)mat);CHKERRQ(ierr);
|
ierr = PetscObjectReference((PetscObject)mat);CHKERRQ(ierr);
|
if (svd->OP) {
|
if (svd->OP) {
|
ierr = MatDestroy(svd->OP);CHKERRQ(ierr);
|
ierr = MatDestroy(svd->OP);CHKERRQ(ierr);
|
}
|
}
|
| Line 73... |
Line 73... |
.seealso: SVDSolve(), SVDSetOperator()
|
.seealso: SVDSolve(), SVDSetOperator()
|
@*/
|
@*/
|
PetscErrorCode SVDGetOperator(SVD svd,Mat *A)
|
PetscErrorCode SVDGetOperator(SVD svd,Mat *A)
|
{
|
{
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(svd,SVD_COOKIE,1);
|
PetscValidHeaderSpecific(svd,SVD_CLASSID,1);
|
PetscValidPointer(A,2);
|
PetscValidPointer(A,2);
|
*A = svd->OP;
|
*A = svd->OP;
|
PetscFunctionReturn(0);
|
PetscFunctionReturn(0);
|
}
|
}
|
|
|
| Line 108... |
Line 108... |
PetscInt i,k,M,N,nloc;
|
PetscInt i,k,M,N,nloc;
|
PetscScalar *pV;
|
PetscScalar *pV;
|
PetscReal norm;
|
PetscReal norm;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(svd,SVD_COOKIE,1);
|
PetscValidHeaderSpecific(svd,SVD_CLASSID,1);
|
if (svd->setupcalled) PetscFunctionReturn(0);
|
if (svd->setupcalled) PetscFunctionReturn(0);
|
ierr = PetscLogEventBegin(SVD_SetUp,svd,0,0,0);CHKERRQ(ierr);
|
ierr = PetscLogEventBegin(SVD_SetUp,svd,0,0,0);CHKERRQ(ierr);
|
|
|
/* Set default solver type */
|
/* Set default solver type */
|
if (!((PetscObject)svd)->type_name) {
|
if (!((PetscObject)svd)->type_name) {
|
| Line 260... |
Line 260... |
{
|
{
|
PetscErrorCode ierr;
|
PetscErrorCode ierr;
|
PetscInt i;
|
PetscInt i;
|
|
|
PetscFunctionBegin;
|
PetscFunctionBegin;
|
PetscValidHeaderSpecific(svd,SVD_COOKIE,1);
|
PetscValidHeaderSpecific(svd,SVD_CLASSID,1);
|
if (n<0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
|
if (n<0) SETERRQ(PETSC_ERR_ARG_OUTOFRANGE,"Argument n cannot be negative");
|
|
|
/* free previous non-processed vectors */
|
/* free previous non-processed vectors */
|
if (svd->nini<0) {
|
if (svd->nini<0) {
|
for (i=0;i<-svd->nini;i++) {
|
for (i=0;i<-svd->nini;i++) {
|