Hi,

exactly, I want to reuse an existing DenseMatrix to avoid having to allocate
memory. The use case is that I want to check for convergence within a loop:

DenseMatrix newMatrix = new DenseMatrix(initialMatrix);
while(!converged)
{
     // do computation on newMatrix
     converged = checkConvergence(initialMatrix, newMatrix);
     // now copy newMatrix to initialMatrix
     initialMatrix.assign(newMatrix);
}

I could do this using clone, but this would result in memory allocation for
each time the loop is invoked, simply overwriting the matrix would probably
be faster.

I hope this clears things up :)

On Mon, Jul 5, 2010 at 1:18 PM, Sean Owen <sro...@gmail.com> wrote:

> True that -- so would creating a new DenseVector and filling it. Is
> that vector going to be reused? OK I get it then.
>
> On Mon, Jul 5, 2010 at 12:11 PM, Jake Mannix <jake.man...@gmail.com>
> wrote:
> > clone() allocates new memory, while this doesn't, right?
> >
>

Reply via email to