[refact] Added activation model
This is a copy of the !48 (closed) with the following changes:
- It has been rebased on top of the topic/refact
- The destination branch of this PR is topic/refact. =---------------------------------------------------------------------------------------------------------
Activation function are introduced for extending the Gauss-Newton model. Instead of having cost = .5_r.T_r = sum(.5_ri2), we put cost = sum(a(ri)), where a is a scalar-to-scalar function. For example, the classical case is a(x)=.5_x2. The activation model should return the vector of activation [a(r1) ... a(rn) ] in the forward pass (calc function) and the first and second derivatives in the backward pass (calcdiff). Here I introduced the activation function in the cost3d only. If accepted, this first commit should be extended to the other cost models. In particular, it should replace the cost weights manually added to the cost-regx.