Adding dyadic term in a bilinearform

I am trying to add a dyadic term in a bilinearform, but the followins script does not work with the error.

TypeError: unsupported operand type(s) for *: ‘ngsolve.la.DynamicVectorExpression’ and ‘ngsolve.la.DynamicVectorExpression’

a = BilinearForm(fes)
a += nu*(grad(u)*grad(v))*dx

gfu = GridFunction(fes)
gfu.Set(x)

a.mat += (a.mat*gfu.vec)*(trasnpose(a.mat*gfu.vec))

Do I have to convert all the matrices and vectors in numpy?

the outer product of the vectors would give a full matrix - which you don’t want to store.
I guess you like to build an operator algebra, representing the rank-one matrix as such?

An example is here:
https://jschoeberl.github.io/iFEM/saddlepoint/fewconstraints.html

Joachim

I was working on a magnetic field problem with nonlinear BH curve.
I needed the attached matrix, but gave up.
I changed my mind to use BilinearFrom.Apply method.