Index: /issm/trunk-jpl/src/c/classes/matrix/Matrix.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/Matrix.h	(revision 13879)
+++ /issm/trunk-jpl/src/c/classes/matrix/Matrix.h	(revision 13880)
@@ -76,4 +76,31 @@
 		}
 		/*}}}*/
+		/*FUNCTION Matrix(int m,int n,int M,int N,int* d_nnz,int* o_nnz,int type){{{*/
+		#ifdef _HAVE_PETSC_
+		Matrix(int m,int n,int M,int N,int* d_nnz,int* o_nnz,int in_type=PetscMatType){
+		#else
+		Matrix(int m,int n,int M,int N,int* d_nnz,int* o_nnz,int in_type=SeqMatType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pmatrix=NULL;
+			#endif
+			smatrix=NULL;
+			type=in_type;
+
+			if(type==PetscMatType){
+				#ifdef _HAVE_PETSC_
+				this->pmatrix=new PetscMat(m,n,M,N,d_nnz,o_nnz);
+				#else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+				#endif
+			}
+			else if(type==SeqMatType){
+				this->smatrix=new SeqMat<doubletype>(m,n,M,N,d_nnz,o_nnz);
+			}
+			else _error_("Matrix type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
 		/*FUNCTION Matrix(int M,int N,IssmDouble sparsity,int in_type){{{*/
 		#ifdef _HAVE_PETSC_
Index: /issm/trunk-jpl/src/c/classes/matrix/Vector.h
===================================================================
--- /issm/trunk-jpl/src/c/classes/matrix/Vector.h	(revision 13879)
+++ /issm/trunk-jpl/src/c/classes/matrix/Vector.h	(revision 13880)
@@ -75,4 +75,31 @@
 		}
 		/*}}}*/
+		/*FUNCTION Vector(int m,int M,int in_type){{{*/
+		#ifdef _HAVE_PETSC_
+		Vector(int m,int M,int in_type=PetscVecType){
+		#else
+		Vector(int m,int M,int in_type=SeqVecType){
+		#endif
+
+			#ifdef _HAVE_PETSC_
+			pvector=NULL;
+			#endif
+			svector=NULL;
+			type=in_type;
+
+			if(type==PetscVecType){
+			#ifdef _HAVE_PETSC_
+				this->pvector=new PetscVec(m,M);
+			 #else
+				_error_("Petsc matrix format not usable, as Petsc has not been compiled!");
+			 #endif
+			}
+			else if(type==SeqVecType){
+				this->svector=new SeqVec<doubletype>(m,M);
+			}
+			else _error_("Vector type: " << type << " not supported yet!");
+
+		}
+		/*}}}*/
 		/*FUNCTION Vector(doubletype* serial_vec,int M,int in_type){{{*/
 		#ifdef _HAVE_PETSC_
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h	(revision 13879)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqMat.h	(revision 13880)
@@ -59,4 +59,13 @@
 			this->matrix=NULL;
 			if(M*N) this->matrix=xNewZeroInit<doubletype>(pM*pN);
+		}
+		/*}}}*/
+		/*FUNCTION SeqMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz){{{*/
+		SeqMat(int m,int n,int pM,int pN,int* d_nnz,int* o_nnz){
+
+			this->M=pM;
+			this->N=pN;
+			this->matrix=NULL;
+			if(pM*pN) this->matrix=xNewZeroInit<doubletype>(pM*pN);
 		}
 		/*}}}*/
Index: /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h	(revision 13879)
+++ /issm/trunk-jpl/src/c/toolkits/issm/SeqVec.h	(revision 13880)
@@ -49,4 +49,12 @@
 		}
 		/*}}}*/
+		/*FUNCTION SeqVec(int m,int M){{{*/
+		SeqVec(int pm,int pM){
+
+			this->M=pM;
+			this->vector=NULL;
+			if(this->M) this->vector=xNewZeroInit<doubletype>(pM);
+		}
+		/*}}}*/
 		/*FUNCTION SeqVec(int M,bool fromlocalsize){{{*/
 		SeqVec(int pM,bool fromlocalsize){
Index: /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 13879)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.cpp	(revision 13880)
@@ -38,4 +38,14 @@
 
 	this->matrix=NewMat(M,N,sparsity,IssmComm::GetComm());
+}
+/*}}}*/
+/*FUNCTION PetscMat::PetscMat(int M,int N, IssmDouble sparsity){{{*/
+PetscMat::PetscMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz){
+
+	MatCreate(IssmComm::GetComm(),&this->matrix);
+	MatSetSizes(this->matrix,m,n,M,N);
+	MatSetFromOptions(this->matrix);
+	MatMPIAIJSetPreallocation(this->matrix,0,d_nnz,0,o_nnz);
+
 }
 /*}}}*/
Index: /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.h	(revision 13879)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscMat.h	(revision 13880)
@@ -31,13 +31,14 @@
 		#endif
 
-		/*PetscMat constructors, destructors {{{*/
+		/*PetscMat constructors, destructors*/
 		PetscMat();
 		PetscMat(int M,int N);
 		PetscMat(int M,int N,IssmDouble sparsity);
+		PetscMat(int m,int n,int M,int N,int* d_nnz,int* o_nnz);
 		PetscMat(IssmDouble* serial_mat,int M,int N,IssmDouble sparsity);
 		PetscMat(int M,int N,int connectivity,int numberofdofspernode);
 		~PetscMat();
-		/*}}}*/
-		/*PetscMat specific routines {{{*/
+
+		/*PetscMat specific routines*/
 		void AllocationInfo(void);
 		void Echo(void);
@@ -51,6 +52,4 @@
 		void SetValues(int m,int* idxm,int n,int* idxn,IssmDouble* values,InsMode mode);
 		void Convert(MatrixType type);
-		/*}}}*/
-
 };
 
Index: /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp	(revision 13879)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.cpp	(revision 13880)
@@ -31,4 +31,14 @@
 
 	this->vector=NewVec(M,IssmComm::GetComm(),fromlocalsize);
+
+}
+/*}}}*/
+/*FUNCTION PetscVec::PetscVec(int m,int M){{{*/
+PetscVec::PetscVec(int m,int M){
+
+	VecCreate(IssmComm::GetComm(),&this->vector);
+	VecSetSizes(this->vector,m,M);
+	VecSetFromOptions(this->vector);
+	VecSet(this->vector,0.0);
 
 }
Index: /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h
===================================================================
--- /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h	(revision 13879)
+++ /issm/trunk-jpl/src/c/toolkits/petsc/objects/PetscVec.h	(revision 13880)
@@ -30,12 +30,13 @@
 		#endif
 
-		/*PetscVec constructors, destructors {{{*/
+		/*PetscVec constructors, destructors*/
 		PetscVec();
 		PetscVec(int M,bool fromlocalsize=false);
+		PetscVec(int m,int M);
 		PetscVec(IssmDouble* buffer, int M);
 		PetscVec(Vec petsc_vec);
 		~PetscVec();
-		/*}}}*/
-		/*PetscVec specific routines {{{*/
+
+		/*PetscVec specific routines*/
 		void Echo(void);
 		void Assemble(void);
@@ -55,5 +56,4 @@
 		void PointwiseDivide(PetscVec* x,PetscVec* y);
 		IssmDouble Dot(PetscVec* vector);
-		/*}}}*/
 };
 
