Method for calculating the gradient with respect to the parameters while keeping x
fixed at the specified value.
Namespace:
CenterSpace.NMath.CoreAssembly: NMath (in NMath.dll) Version: 5.1.0.0
Syntax
| C# |
|---|
public virtual void GradientWithRespectToParams( DoubleVector parameters, double x, ref DoubleVector grad ) |
| Visual Basic (Declaration) |
|---|
Public Overridable Sub GradientWithRespectToParams ( _ parameters As DoubleVector, _ x As Double, _ ByRef grad As DoubleVector _ ) |
| Visual C++ |
|---|
public: virtual void GradientWithRespectToParams( DoubleVector^ parameters, double x, DoubleVector^% grad ) |
Parameters
- parameters
- Type: CenterSpace.NMath.Core..::.DoubleVector
The gradient with respect to the parameters will be evaluated at this point.
- x
- Type: System..::.Double
The point to fix x to.
- grad
- Type:
CenterSpace.NMath.Core..::.DoubleVector
%
On entry a vector of the correct size (same as the number of parameters). On exit contains the values of the gradient.
Remarks
For example, if
f(x: a, b) = a*cos(b*x) + b*sin(a*x)
is a function parameterized on a and b, then for a fixed value of x we can think
of f as being a function of a and b. We can then take the partial derivatives of f
with respect to a and b to form the gradient with respect to the parameters:
grad(a,b) = { fa(a,b), fb(a,b) } = { cos(b*x) + b*x*cos(a*x), -x*a*sin(b*x) + sin(a*x) }.
Exceptions
| Exception | Condition |
|---|---|
| CenterSpace.NMath.Core..::.InvalidArgumentException | Thrown if the length of the input gradient vector is not equal to the length of the vector of parameter values. |