`FixedPolynomials.GradientConfig`

— Type`GradientConfig(f::Polynomial{T}, [x::AbstractVector{S}])`

A data structure with which the gradient of a `Polynomial`

`f`

can be evaluated efficiently. Note that `x`

is only used to determine the output type of `f(x)`

.

`GradientConfig(f::Polynomial{T}, [S])`

Instead of a vector `x`

a type can also be given directly.

`FixedPolynomials.GradientDiffResult`

— Type`GradientDiffResult(cfg::GradientConfig)`

During the computation of $∇g(x)$ we compute nearly everything we need for the evaluation of $g(x)$. GradientDiffResult allocates memory to hold both values. This structure also signals `gradient!`

to store $g(x)$ and $∇g(x)$.

**Example**

```
cfg = GradientConfig(g, x)
r = GradientDiffResult(cfg)
gradient!(r, g, x, cfg)
value(r) == g(x)
gradient(r) == gradient(g, x, cfg)
```

`GradientDiffResult(grad::AbstractVector)`

Allocate the memory to hold the gradient by yourself.

`FixedPolynomials.JacobianConfig`

— Type`JacobianConfig(F::Vector{Polynomial{T}}, [x::AbstractVector{S}])`

A data structure with which the jacobian of a `Vector`

`F`

of `Polynomial`

s can be evaluated efficiently. Note that `x`

is only used to determine the output type of `F(x)`

.

`JacobianConfig(F::Vector{Polynomial{T}}, [S])`

Instead of a vector `x`

a type can also be given directly.

`FixedPolynomials.JacobianDiffResult`

— Type`JacobianDiffResult(cfg::GradientConfig)`

During the computation of the jacobian $J_F(x)$ we compute nearly everything we need for the evaluation of $F(x)$. `JacobianDiffResult`

allocates memory to hold both values. This structure also signals `jacobian!`

to store $F(x)$ and $J_F(x)$.

**Example**

```
cfg = JacobianConfig(F, x)
r = JacobianDiffResult(cfg)
jacobian!(r, F, x, cfg)
value(r) == map(f -> f(x), F)
jacobian(r) == jacobian(F, x, cfg)
```

`JacobianDiffResult(value::AbstractVector, jacobian::AbstractMatrix)`

Allocate the memory to hold the value and the jacobian by yourself.

`FixedPolynomials.Polynomial`

— Type`Polynomial(p::MultivariatePolynomials.AbstractPolynomial [, variables [, homogenized=false]])`

A structure for fast evaluation of multivariate polynomials. The terms are sorted first by total degree, then lexicographically. `Polynomial`

has first class support for homogenous polynomials. This field indicates whether the first variable should be considered as the homogenization variable.

`Polynomial{T}(p::MultivariatePolynomials.AbstractPolynomial [, variables [, homogenized=false]])`

You can force a coefficient type `T`

. For optimal performance `T`

should be same type as the input to with which it will be evaluated.

`Polynomial(exponents::Matrix{Int}, coefficients::Vector{T}, variables, [, homogenized=false])`

You can also create a polynomial directly. Note that in exponents each column represents the exponent of a term.

**Example**

`Poly([3 1; 1 1; 0 2 ], [-2.0, 3.0], [:x, :y, :z]) == 3.0x^2yz^2 - 2x^3y`

`FixedPolynomials.System`

— Type`System(polys [, variables])`

Construct a system of polynomials from the given polynomials `polys`

.

`FixedPolynomials.coefficients`

— Method`coefficients(p::Polynomial)`

Returns the coefficient vector of `p`

.

`FixedPolynomials.config`

— Method`config(F::Polynomial, x)`

Construct a `GradientConfig`

for the evaluation of `f`

with values like `x`

.

`FixedPolynomials.config`

— Method`config(F::System, x)`

Construct a `JacobianConfig`

for the evaluation of `F`

with values like `x`

.

`FixedPolynomials.degree`

— Method`degree(p::Polynomial)`

Returns the (total) degree of p.

`FixedPolynomials.dehomogenize`

— Method`dehomogenize(p::Polynomial)`

Substitute `1`

as for the first variable `p`

, if `ishomogenized(p)`

is `false`

this is just the identity.

`FixedPolynomials.differentiate`

— Method`differentiate(p::Polynomial, varindex::Int)`

Differentiate `p`

w.r.t the `varindex`

th variable.

`differentiate(p::Polynomial)`

Differentiate `p`

w.r.t. all variables.

`FixedPolynomials.evaluate!`

— Function`evaluate!(u, F, x, cfg::JacobianConfig [, precomputed=false])`

Evaluate the system `F`

at `x`

using the precomputated values in `cfg`

and store the result in `u`

. Note that this is usually signifcant faster than `map!(u, f -> evaluate(f, x), F)`

.

**Example**

```
cfg = JacobianConfig(F)
evaluate!(u, F, x, cfg)
```

With `precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `jacobian`

with the same `x`

.

`FixedPolynomials.evaluate`

— Method`evaluate(g, x, cfg::GradientConfig [, precomputed=false])`

Evaluate `g`

at `x`

using the precomputated values in `cfg`

. Note that this is usually signifcant faster than `evaluate(g, x)`

.

**Example**

```
cfg = GradientConfig(g)
evaluate(g, x, cfg)
```

With `precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `gradient`

with the same `x`

.

`FixedPolynomials.evaluate`

— Method`evaluate(F, x, cfg::JacobianConfig [, precomputed=false])`

Evaluate the system `F`

at `x`

using the precomputated values in `cfg`

. Note that this is usually signifcant faster than `map(f -> evaluate(f, x), F)`

. The return vector is constructed using `similar(x, T)`

.

**Example**

```
cfg = JacobianConfig(F)
evaluate(F, x, cfg)
```

With `precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `jacobian`

with the same `x`

.

`FixedPolynomials.evaluate`

— Method`evaluate(p::Polynomial{T}, x::AbstractVector{T})`

Evaluates `p`

at `x`

, i.e. $p(x)$. `Polynomial`

is also callable, i.e. you can also evaluate it via `p(x)`

.

`FixedPolynomials.evaluate_and_jacobian!`

— Method`evaluate_and_jacobian!(u, U, F, x, cfg::JacobianConfig)`

Evaluate `F`

and its Jacobian at `x`

using the precomputated values in `cfg`

and store the result in `u`

and `U`

(Jacobian).

**Example**

`evaluate_and_jacobian!(u, U, F, x, config(F, x))`

`FixedPolynomials.exponents`

— Method`exponents(p::Polynomial)`

Returns the exponents matrix of `p`

. Each column represents the exponents of a term of `p`

.

`FixedPolynomials.gradient!`

— Method`gradient!(u, g, x, cfg::GradientConfig [, precomputed=false])`

Compute the gradient of `g`

at `x`

using the precomputated values in `cfg`

and store thre result in u.

**Example**

```
cfg = GradientConfig(g)
gradient(u, g, x, cfg)
```

With `precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `gradient`

with the same `x`

.

`FixedPolynomials.gradient!`

— Method`gradient!(r::GradientDiffResult, g, x, cfg::GradientConfig)`

Compute $g(x)$ and the gradient of `g`

at `x`

at once using the precomputated values in `cfg`

and store thre result in `r`

. This is faster than calling both values separetely.

**Example**

```
cfg = GradientConfig(g)
r = GradientDiffResult(r)
gradient!(r, g, x, cfg)
value(r) == g(x)
gradient(r) == gradient(g, x, cfg)
```

`FixedPolynomials.homogenize`

— Function`homogenize(p::Polynomial [, variable = :x0])`

Makes `p`

homogenous, if `ishomogenized(p)`

is `true`

this is just the identity. The homogenization variable will always be considered as the first variable of the polynomial.

`FixedPolynomials.ishomogenized`

— Method`ishomogenized(p::Polynomial)`

Checks whether `p`

was homogenized.

`FixedPolynomials.ishomogenous`

— Method`ishomogenous(p::Polynomial)`

Checks whether `p`

is a homogenous polynomial. Note that this is unaffected from the value of `homogenized(p)`

.

`FixedPolynomials.jacobian!`

— Function`jacobian!(u, F, x, cfg::JacobianConfig [, precomputed=false])`

Evaluate the jacobian of `F`

at `x`

using the precomputated values in `cfg`

and store the result in `u`

.

**Example**

```
cfg = JacobianConfig(F)
jacobian!(u, F, x, cfg)
```

With `precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `jacobian`

with the same `x`

.

`FixedPolynomials.jacobian!`

— Method`jacobian!(r::JacobianDiffResult, F, x, cfg::JacobianConfig)`

Compute $F(x)$ and the jacobian of `F`

at `x`

at once using the precomputated values in `cfg`

and store thre result in `r`

. This is faster than computing both values separetely.

**Example**

```
cfg = GradientConfig(g)
r = GradientDiffResult(cfg)
gradient!(r, g, x, cfg)
value(r) == g(x)
gradient(r) == gradient(g, x, cfg)
```

`FixedPolynomials.jacobian`

— Method`jacobian(u, F, x, cfg::JacobianConfig [, precomputed=false])`

Evaluate the jacobian of `F`

at `x`

using the precomputated values in `cfg`

. The return matrix is constructed using `similar(x, T, m, n)`

.

**Example**

```
cfg = JacobianConfig(F)
jacobian(F, x, cfg)
```

`precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `jacobian`

with the same `x`

.

`FixedPolynomials.nterms`

— Method`nterms(p::Polynomial)`

Returns the number of terms of p

`FixedPolynomials.nvariables`

— Method`nvariables(p::Polynomial)`

Returns the number of variables of p

`FixedPolynomials.nvariables`

— Method`nvariables(F::System)`

Returns the number of variables of `F`

.

`FixedPolynomials.scale_coefficients!`

— Method`scale_coefficients!(f::Polynomial, λ)`

Scale the coefficients of `f`

with the factor `λ`

.

`FixedPolynomials.substitute`

— Method`substitute(p::Polynomial, i, x)`

In `p`

substitute for the variable with index `i`

the value `x`

. You can use this for partial evaluation of polynomial.

**Example**

```
julia> substitute(x^2+3y, 2, 5)
x^2+15
```

`FixedPolynomials.value`

— Method`value(r::GradientDiffResult)`

Get the currently stored value in `r`

.

`FixedPolynomials.variables`

— Method`variables(p::Polynomial)`

Returns the variables of `p`

.

`FixedPolynomials.weyldot`

— Method`weyldot(f::Polynomial, g::Polynomial)`

Compute the Bombieri-Weyl dot product. Note that this is only properly defined if `f`

and `g`

are homogenous.

`weyldot(f::Vector{Polynomial}, g::Vector{Polynomial})`

Compute the dot product for vectors of polynomials.

`FixedPolynomials.weylnorm`

— Method`weylnorm(f::Polynomial)`

Compute the Bombieri-Weyl norm. Note that this is only properly defined if `f`

is homogenous.

`FixedPolynomials.∇`

— Method`∇(p::Polynomial)`

Returns the gradient vector of `p`

. This is the same as `differentiate`

.

`FixedPolynomials.gradient`

— Method`gradient(r::GradientDiffResult)`

Get the currently stored gradient in `r`

.

`FixedPolynomials.gradient`

— Method`gradient(g, x, cfg::GradientConfig[, precomputed=false])`

Compute the gradient of `g`

at `x`

using the precomputated values in `cfg`

. The return vector is constructed using `similar(x, T)`

.

**Example**

```
cfg = GradientConfig(g)
gradient(g, x, cfg)
```

With `precomputed=true`

we rely on the previous intermediate results in `cfg`

. Therefore the result is only correct if you previouls called `evaluate`

, or `gradient`

with the same `x`

.

`FixedPolynomials.gradient_row!`

— Method`gradient_row!(u::AbstractMatrix, x::AbstractVector, cfg::PolyConfig{T}, i)`

Store the gradient in the i-th row of 'u'.

`FixedPolynomials.lt_total_degree`

— MethodSorts two vectory by total degree

`FixedPolynomials.multinomial`

— MethodComputes the multinomial coefficient (|k| \over k)