dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #05866
Mathematical operations in GenericMatrix/Vector interfaces?
Would it be ok now to add arithmetic operations in the Generic*
interfaces? They can be limited to objects of the same type, using a
type assertion like init already must do for the sparsity pattern. A
fairly small set of operations will allow us to write many linear
algebra algorithms in PyDolfin for any backend, great for
application-specialized algorithms and rapid prototyping.
Vectors:
v+u
a*v
Matrices:
A+B
a*A
Matrix-vector:
A*v
If there are any good reasons to avoid this (f.ex. virtual operators
in C++ doesn't exist), I suggest either defining separate interfaces
for arithmetic operations (f.ex. a GenericOperator could be something
with a matrix-vector product) or at the very least defining
conventions for these operations, which would allow PyDolfin apps to
use this by "duck-typing" (since Python is dynamically typed).
--
Martin
Follow ups