dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #07388
Re: operator() or operator[]
On Fri, Apr 11, 2008 at 01:58:47PM +0200, Ola Skavhaug wrote:
> Martin Sandve Alnæs skrev den 11/04-2008 følgende:
> > 2008/4/11, Anders Logg <logg@xxxxxxxxx>:
> > > On Fri, Apr 11, 2008 at 12:23:15PM +0100, Garth N. Wells wrote:
> > > >
> > > >
> > > > Anders Logg wrote:
> > > > > Which one do we want to use for element access in vectors and
> > > > > matrices. It looks like operator() is now implemented for uBlasVector,
> > > > > but isn't operator[] more natural to use?
> > > > >
> > > >
> > > > Much the same to me. We've used (.,.) for matrices, so it seems natural
> > > > to use (.) for vectors.
> > > >
> > > > Garth
> > >
> > >
> > > We could use [] for matrices also I guess.
> > >
> > > Then it will look the same as numpy.
> >
> > It's useful to index vectors with [], since the code will be similar
> > for regular arrays.
>
> Agree. Dolfin doesn't compile with PETSc now, because of a bug in the copy
> method:
>
> void PETScVector::copy(const uBlasVector& y, uint off1, uint off2, uint len)
> {
> // FIXME: Verify if there's a more efficient implementation
>
> real* vals = array();
> for(uint i = 0; i < len; i++)
> vals[i + off1] = y[i + off2];
> restore(vals);
> }
>
> uBlasVector doesn't have operator[] implemented. Is anybody on this problem?
>
> Ola
That was fixed ages ago:
http://www.fenics.org/hg/dolfin?cs=fac56a64131c
--
Anders
References