Describe the bug
The P and Q weights in divergence.cpp and gradient.cpp and associated divergence.h and gradient.h are not technically correct and confuse users.
To Reproduce
View the source code
I suggest removing them, and implementing a similar function to weightsP.m and weightsQ.m.
It would be sufficient to just remove the references in the C++ code.