For computing the gradient of a scalar field, one can use the weighted least squares method as described in the paper Revisiting the Least-squares Procedure for Gradient Reconstruction on Unstructured Meshes by Dimitri Mavriplis (pg. 23).

My question is: How can I reconstruct a gradient of a vector field?

In the paper Least-squares gradient calculation from multi-point observations of scalar and vector fields: methodology and applications with Cluster in the plasmasphere by J. De Keyser, et al., it seems that one could consider the vector field components as scalar fields and feed this to the gradient calculation, under some assumptions.

I'm writing currently a generic C++ method that is supposed to compute this, where the result rank is determined by outer product trait classes defined for all combinations available (scalar vector, vector-tensor, tensor-vector, vector-vector, etc). Any thoughts on how to approach this?


1 Answer 1


No assumption is needed to reduce the vector least squares problem to scalar least squares problems. But you can take advantage of the fact that the matrix is the same for all vector components, so you can solve a single least squares problem with multiple right hand sides, saving factorizations.

  • $\begingroup$ Great, thank you so much! I've written out the minimization problem for the general quantity and I've seen that the matrix of the coefficients only comes from the geometrical configuration of the points, so I'll definitely store this and update it with respect to the change of point positions. Now all that is left is the code structure for the class templates, and here I'm at home. :) $\endgroup$
    – tmaric
    Apr 30, 2012 at 17:17
  • 1
    $\begingroup$ @tomislav-maric: It may be more efficient to store and update a factorization associated with the matrix (google low rank update). $\endgroup$ Apr 30, 2012 at 17:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.