← Back to team overview

dolfin team mailing list archive

Re: Save the solutions in a matrix

 

On Sat, Jun 14, 2008 at 05:31:56PM -0400, Hatef Monajemi wrote:
> 
> Hello,
> 
> I am trying to solve a problem with different parameters; I am having a
> loop and each time I am getting a solution vector (say Function u1) and
> I need to save each vector as a column of an arbitrary matrix in dolfin
> (say Matrix S). I would appreciate if you let me know how it is
> possible. I tried the following scheme:
> 
> Loop over i:
> 
> Matrix S;
> d=u1.vector();
> 
> for(j)
> {  
>   S(i,j)=d(j);
> {
> 
> But it is not going to work! any help on this matter is appreciated.
> 
> 
> Hatef:)

Accessing columns in our sparse matrices is very inefficient. You
could use a dense matrix, but I suggest storing each solution to a
separate file as a Function:

  file << u1;

-- 
Anders

Attachment: signature.asc
Description: Digital signature


Follow ups

References