ufuncs, iterators
Matthew Knepley
knepley at mcs.anl.gov
Thu Aug 18 19:57:02 CDT 2005
Simon Burton <simon at arrowtheory.com> writes:
> Hi,
>
> Along the lines of python's numarray [1], we need some way of
> operating pointwise (and inner/outer operations) on Mat/Vec objects.
>
> In particular, we need things like the following:
> (a) v=add.reduce(m) (sum along rows/cols of a Mat to produce a Vec)
This seems to be handled.
> (b) m=add.outer(v1,v2) (sum of all elements of two Vecs to produce a Mat)
This should be in MatDense() interface specifically since it produces a dense matrix. In fact,
I thought it was always preferrable not to form the matrix explicitly. I would have to see how
it is used.
> (c) m=add(m1,m2) (pointwise sum)
We have MatAXPY()
> (d) m=exp(m) (pointwise exp)
We could add pointwise operations just like the VecPointwise*().
Matt
> Right now we can do (a) and (b) using dgemm and single column/row matrices with just 1s,
> and we can do (c) using SetValues. But for (d): it looks like we will be writing a c-loop ?
>
> And I don't think the PETSc interface to dgemm (MatMatMult*) is general enough to do (b)
> (we need one of the products to be added to the other product, so beta=1).
>
> It would be easy enough to use numarray to "shadow" the PETSc arrays (using *GetArray)
> and then make numarray do the work, but this seems doomed to failure because
> numarray is inherently dense.
>
> Simon.
>
>
> [1]: http://stsdas.stsci.edu/numarray/numarray-1.3.html/node35.html
>
> --
> Simon Burton, B.Sc.
> Licensed PO Box 8066
> ANU Canberra 2601
> Australia
> Ph. 61 02 6249 6940
> http://arrowtheory.com
>
>
>
--
"Failure has a thousand explanations. Success doesn't need one" -- Sir Alec Guiness
More information about the petsc-dev
mailing list