Matrix multiplication with a vector in ufl

Hello there, can someone please assist me by showing me an example of a matrix times vector in ufl.

The Python multiplication operator * is overloaded to perform this:

from dolfin import *

# Create matrix and vector in UFL:
mat = as_matrix([[1,1],
                 [1,1]])
vec = as_vector([2,3])

# Multiplication operator is overloaded:
mat_vec = mat*vec

# Check shape of product:
print(mat_vec.ufl_shape)
1 Like