Subversion Repositories slepc-dev

Rev

Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
   User interface for the SLEPc dense matrix operations.

   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
   SLEPc - Scalable Library for Eigenvalue Problem Computations
   Copyright (c) 2002-2010, Universidad Politecnica de Valencia, Spain

   This file is part of SLEPc.
     
   SLEPc is free software: you can redistribute it and/or modify it under  the
   terms of version 3 of the GNU Lesser General Public License as published by
   the Free Software Foundation.

   SLEPc  is  distributed in the hope that it will be useful, but WITHOUT  ANY
   WARRANTY;  without even the implied warranty of MERCHANTABILITY or  FITNESS
   FOR  A  PARTICULAR PURPOSE. See the GNU Lesser General Public  License  for
   more details.

   You  should have received a copy of the GNU Lesser General  Public  License
   along with SLEPc. If not, see <http://www.gnu.org/licenses/>.
   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/



#if !defined(__SLEPCMATDENSE_H)
#define __SLEPCMATDENSE_H

#include "slepcsys.h"
PETSC_EXTERN_CXX_BEGIN

extern PetscErrorCode MatDenseInitializePackage(const char[]);

/*S
     MatDense - Abstract PETSc dense matrix object

   Level: beginner

  Concepts: matrix; linear operator

.seealso:  MatDenseCreate(), MatDenseType, MatDenseSetType()
S*/

typedef struct _p_MatDense*      MatDense;

/*E
    MatDenseType - String with the name of a SLEPc matrix dense object

    Level: beginner

.seealso: MatDenseSetType(), MatDense
E*/

#define MatDenseType      char*
#define MATDENSEBASIC     "basic"
#define MATDENSEVEC       "vec"
#define MATDENSEMAGMA     "magma"

/* Logging support */
extern PetscClassId  MATDENSE_CLASSID;

/*E
    MatDenseDuplicateOption - Indicates if a duplicated dense matrix should have
  its numerical values copied, or should not or share the same data.

    Level: beginner

.seealso: MatDenseDuplicate()
E*/

typedef enum { MATDENSE_DO_NOT_COPY_VALUES=1,
               MATDENSE_COPY_VALUES,
               MATDENSE_MAKE_SIBLING         } MatDenseDuplicateOption;

extern PetscFList MatDenseList;
extern PetscBool  MatDenseRegisterAllCalled;


/*MC
   MatDenseRegisterDynamic - Adds dense matrix object MatDense package.

   Synopsis:
   PetscErrorCode MatDenseRegisterDynamic(const char *name_object,const char *path,const char *name_create,PetscErrorCode (*routine_create)(MatDense))

   Not Collective

   Input Parameters:
+  name_object - name of a new user-defined object
.  path - path (either absolute or relative) the library containing this solver
.  name_create - name of routine to create the solver context
-  routine_create - routine to create the solver context

   Notes:
   MatDenseRegisterDynamic() may be called multiple times to add several user-defined solvers.

   If dynamic libraries are used, then the fourth input argument (routine_create)
   is ignored.

   Sample usage:
.vb
   MatDenseRegisterDynamic("my_obj",/home/username/my_lib/lib/libO/solaris/mylib.a,
               "MySolverCreate",MySolverCreate);
.ve

   Then, your solver can be chosen with the procedural interface via
$     MatDenseSetType(mat,"my_solver")
   or at runtime via the option
$     -matdense_type my_solver

   Level: advanced

.seealso: MatDenseRegisterDestroy(), MatDenseRegisterAll()
M*/

#if defined(PETSC_USE_DYNAMIC_LIBRARIES)
#define MatDenseRegisterDynamic(a,b,c,d) MatDenseRegister(a,b,c,0)
#else
#define MatDenseRegisterDynamic(a,b,c,d) MatDenseRegister(a,b,c,d)
#endif

PetscErrorCode MatDenseCreate(MPI_Comm,MatDense*);
PetscErrorCode MatDenseSetMaxSizes(MatDense,PetscInt,PetscInt);
PetscErrorCode MatDenseSetSizes(MatDense,PetscInt,PetscInt,PetscInt,PetscInt);
PetscErrorCode MatDenseGetSizes(MatDense mat,PetscInt *m0,PetscInt *n0,PetscInt *m,PetscInt* n);
PetscErrorCode MatDenseDestroy(MatDense*);
PetscErrorCode MatDenseGetArray(MatDense,PetscScalar**);
PetscErrorCode MatDenseRestoreArray(MatDense,PetscScalar**);
PetscErrorCode MatDenseGetArrayRead(MatDense A,const PetscScalar *v[]);
PetscErrorCode MatDenseRestoreArrayRead(MatDense A,const PetscScalar *v[]);
PetscErrorCode MatDenseDuplicate(MatDense,MatDenseDuplicateOption,MatDense*);
PetscErrorCode MatDenseAreSiblings(MatDense A,MatDense B,PetscBool *aresiblings);
PetscErrorCode MatDenseMatMult(MatDense,PetscScalar,PetscScalar,MatDense,PetscBool,MatDense,PetscBool);
PetscErrorCode MatDenseCopy(MatDense,MatDense);
PetscErrorCode MatDenseAXPY(MatDense Y,PetscScalar a,MatDense X);
PetscErrorCode MatDenseSetExplicit(MatDense A);
PetscErrorCode MatDenseSetFromOptions(MatDense);
PetscErrorCode MatDenseView(MatDense mat,PetscViewer viewer);
PetscErrorCode MatDenseSetUpPreallocation(MatDense);
PetscErrorCode MatDenseSetType(MatDense,const MatDenseType);
PetscErrorCode MatDenseFinalizePackage(void);
PetscErrorCode MatDenseInitializePackage(const char*);
PetscErrorCode MatDenseGetType(MatDense,const MatDenseType*);
PetscErrorCode MatDenseRegister(const char*,const char*,const char*,PetscErrorCode (*)(MatDense));
PetscErrorCode MatDenseRegisterDestroy(void);
PetscErrorCode MatDenseReduce(MatDense A,MPI_Op op);

PetscErrorCode MatDenseCreateBasic(MPI_Comm comm,PetscInt M,PetscInt N,PetscInt m,PetscInt n,PetscScalar *data,MatDense *A);
PetscErrorCode MatDenseSerialize(MatDense A,PetscInt *length,PetscScalar *array);
PetscErrorCode MatDenseDeserialize(MatDense A,PetscInt length,PetscScalar *array);
PETSC_EXTERN_CXX_END
#endif