API Overview

The following table gives an overview of the higher-order functional differentiation API provided by DiffSharp.

AD X X X X X X X X X X X X X X X X X
Numerical A A A A A A A A A A A A A A A
Symbolic X X X X X X X X X X X X

Yellow: For scalar-to-scalar functions; Green: For vector-to-scalar functions; Blue: For vector-to-vector functions

X: Exact value; A: Numerical approximation

The main functionality in DiffSharp is provided by the DiffSharp.AD namespace, which supports nested compositions of forward and reverse AD. We also implement symbolic and numerical differentiation, mainly for performance comparisons. Currently the library provides the following namespaces:

• DiffSharp.Numerical: Numerical differentiation with finite differences
• DiffSharp.Symbolic: Symbolic differentiation using code quotations
• DiffSharp.Interop: Nested AD wrapper for easier use from C# and other non-functional languages

All these namespaces have Float32 and Float64 modules, giving you 32- or 64-bit floating point precision. (E.g. DiffSharp.AD.Float32, DiffSharp.Interop.Float64. )

For brief explanations of these implementations, please refer to the Nested AD, Numerical Differentiation, and Symbolic Differentiation pages.

Differentiation Operations and Variants

The operations summarized in the above table have prime-suffixed variants (e.g. diff and diff' ) that return tuples containing the value of the original function together with the value of the desired operation. This provides a performance advantage in the majority of AD operations, since the original function value is almost always computed during the same execution of the code, as a by-product of AD computations.

 1: 2: 3: 4: 5: 6: 7:  open DiffSharp.AD.Float64 // Derivative of Sin(Sqrt(x)) at x = 2 let a = diff (fun x -> sin (sqrt x)) (D 2.) // (Original value, derivative) of Sin(Sqrt(x)) at x = 2 let b, c = diff' (fun x -> sin (sqrt x)) (D 2.) 
 val a : D = D 0.05513442203 val c : D = D 0.05513442203 val b : D = D 0.987765946

The library provides the following differentiation operations:

diff : $$\color{red}{(\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{\mathbb{R}}$$
 1:  diff f x 

The first derivative of a scalar-to-scalar function f, at the point x.

For a function $$f(a): \mathbb{R} \to \mathbb{R}$$, and $$x \in \mathbb{R}$$, this gives the derivative evaluated at $$x$$

$\left. \frac{d}{da} f(a) \right|_{a\; =\; x} \; .$

diff' : $$\color{red}{(\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{(\mathbb{R} \times \mathbb{R})}$$
 1:  diff' f x 

The original value and the first derivative of a scalar-to-scalar function f, at the point x.

diff2 : $$\color{red}{(\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{\mathbb{R}}$$
 1:  diff2 f x 

The second derivative of a scalar-to-scalar function f, at the point x.

For a function $$f(a): \mathbb{R} \to \mathbb{R}$$, and $$x \in \mathbb{R}$$, this gives the second derivative evaluated at $$x$$

$\left. \frac{d^2}{da^2} f(a) \right|_{a\; =\; x} \; .$

diff2' : $$\color{red}{(\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{(\mathbb{R} \times \mathbb{R})}$$
 1:  diff2' f x 

The original value and the second derivative of a scalar-to-scalar function f, at the point x.

diff2'' : $$\color{red}{(\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{(\mathbb{R} \times \mathbb{R} \times \mathbb{R})}$$
 1:  diff2'' f x 

The original value, the first derivative, and the second derivative of a scalar-to-scalar function f, at the point x.

diffn : $$\color{red}{\mathbb{N} \to (\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{\mathbb{R}}$$
 1:  diffn n f x 

The n-th derivative of a scalar-to-scalar function f, at the point x.

For $$n \in \mathbb{N}$$, a function $$f(a): \mathbb{R} \to \mathbb{R}$$, and $$x \in \mathbb{R}$$, this gives the n-th derivative evaluated at $$x$$

$\left. \frac{d^n}{da^n} f(a) \right|_{a\; =\; x} \; .$

diffn' : $$\color{red}{\mathbb{N} \to (\mathbb{R} \to \mathbb{R}) \to \mathbb{R}} \to \color{blue}{(\mathbb{R} \times \mathbb{R})}$$
 1:  diffn' n f x 

The original value and the n-th derivative of a scalar-to-scalar function f, at the point x.

grad : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}^n}$$
 1:  grad f x 

The gradient of a vector-to-scalar function f, at the point x.

For a function $$f(a_1, \dots, a_n): \mathbb{R}^n \to \mathbb{R}$$, and $$\mathbf{x} \in \mathbb{R}^n$$, this gives the gradient evaluated at $$\mathbf{x}$$

$\left( \nabla f \right)_\mathbf{x} = \left. \left[ \frac{\partial f}{{\partial a}_1}, \dots, \frac{\partial f}{{\partial a}_n} \right] \right|_{\mathbf{a}\; = \; \mathbf{x}} \; .$

grad' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R}^n)}$$
 1:  grad' f x 

The original value and the gradient of a vector-to-scalar function f, at the point x.

gradv : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}}$$
 1:  gradv f x v 

The gradient-vector product (directional derivative) of a vector-to-scalar function f, at the point x, along the vector v.

For a function $$f: \mathbb{R}^n \to \mathbb{R}$$, and $$\mathbf{x}, \mathbf{v} \in \mathbb{R}^n$$, this gives the dot product of the gradient of $$f$$ at $$\mathbf{x}$$ with $$\mathbf{v}$$

$\left( \nabla f \right)_\mathbf{x} \cdot \mathbf{v} \; .$

This value can be computed efficiently by the DiffSharp.AD.Forward module in one forward evaluation of the function, without computing the full gradient.

gradv' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R})}$$
 1:  gradv' f x v 

The original value and the gradient-vector product (directional derivative) of a vector-to-scalar function f, at the point x, along the vector v.

hessian : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}^{n \times n}}$$
 1:  hessian f x 

The Hessian of a vector-to-scalar function f, at the point x.

For a function $$f(a_1, \dots, a_n): \mathbb{R}^n \to \mathbb{R}$$, and $$\mathbf{x} \in \mathbb{R}^n$$, this gives the Hessian matrix evaluated at $$\mathbf{x}$$

$\left( \mathbf{H}_f \right)_\mathbf{x} = \left. \begin{bmatrix} \frac{\partial ^2 f}{\partial a_1^2} & \frac{\partial ^2 f}{\partial a_1 \partial a_2} & \cdots & \frac{\partial ^2 f}{\partial a_1 \partial a_n} \\ \frac{\partial ^2 f}{\partial a_2 \partial a_1} & \frac{\partial ^2 f}{\partial a_2^2} & \cdots & \frac{\partial ^2 f}{\partial a_2 \partial a_n} \\ \vdots & \vdots & \ddots & \vdots \\ \frac{\partial ^2 f}{\partial a_n \partial a_1} & \frac{\partial ^2 f}{\partial a_n \partial a_2} & \cdots & \frac{\partial ^2 f}{\partial a_n^2} \end{bmatrix} \right|_{\mathbf{a}\; = \; \mathbf{x}} \; .$

hessian' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R}^{n \times n})}$$
 1:  hessian' f x 

The original value and the Hessian of a vector-to-scalar function f, at the point x.

hessianv : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}^n}$$
 1:  hessianv f x v 

The Hessian-vector product of a vector-to-scalar function f, at the point x, along the vector v.

For a function $$f: \mathbb{R}^n \to \mathbb{R}$$, and $$\mathbf{x}, \mathbf{v} \in \mathbb{R}^n$$, this gives the multiplication of the Hessian matrix of $$f$$ at $$\mathbf{x}$$ with $$\mathbf{v}$$

$\left( \mathbf{H}_f \right)_\mathbf{x} \; \mathbf{v} \; .$

This value can be computed efficiently by the DiffSharp.AD.ForwardReverse module using one forward and one reverse evaluation of the function, in a matrix-free way (without computing the full Hessian matrix).

hessianv' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R}^n)}$$
 1:  hessianv' f x v 

The original value and the Hessian-vector product of a vector-to-scalar function f, at the point x, along the vector v.

gradhessian : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R}^n \times \mathbb{R}^{n \times n})}$$
 1:  gradhessian f x 

The gradient and the Hessian of a vector-to-scalar function f, at the point x.

gradhessian' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R}^n \times \mathbb{R}^{n \times n})}$$
 1:  gradhessian' f x 

The original value, the gradient, and the Hessian of a vector-to-scalar function f, at the point x.

gradhessianv : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R}^n)}$$
 1:  gradhessianv f x v 

The gradient-vector product (directional derivative) and the Hessian-vector product of a vector-to-scalar function f, at the point x, along the vector v.

gradhessianv' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R} \times \mathbb{R}^n)}$$
 1:  gradhessianv' f x v 

The original value, the gradient-vector product (directional derivative), and the Hessian-vector product of a vector-to-scalar function f, at the point x, along the vector v.

laplacian : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}}$$
 1:  laplacian f x 

The Laplacian of a vector-to-scalar function f, at the point x.

For a function $$f(a_1, \dots, a_n): \mathbb{R}^n \to \mathbb{R}$$, and $$\mathbf{x} \in \mathbb{R}^n$$, this gives the sum of second derivatives evaluated at $$\mathbf{x}$$

$\mathrm{tr}\left(\mathbf{H}_f \right)_\mathbf{x} = \left. \left(\frac{\partial ^2 f}{\partial a_1^2} + \dots + \frac{\partial ^2 f}{\partial a_n^2}\right) \right|_{\mathbf{a} \; = \; \mathbf{x}} \; ,$

which is the trace of the Hessian matrix.

This value can be computed efficiently by the DiffSharp.AD.Forward2 module, without computing the full Hessian matrix.

laplacian' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R} \times \mathbb{R})}$$
 1:  laplacian' f x 

The original value and the Laplacian of a vector-to-scalar function f, at the point x.

jacobian : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}^{m \times n}}$$
 1:  jacobian f x 

The Jacobian of a vector-to-vector function f, at the point x.

For a function $$\mathbf{F}: \mathbb{R}^n \to \mathbb{R}^m$$ with components $$F_1 (a_1, \dots, a_n), \dots, F_m (a_1, \dots, a_n)$$, and $$\mathbf{x} \in \mathbb{R}^n$$, this gives the $$m$$-by-$$n$$ Jacobian matrix evaluated at $$\mathbf{x}$$

$\left( \mathbf{J}_\mathbf{F} \right)_\mathbf{x} = \left. \begin{bmatrix} \frac{\partial F_1}{\partial a_1} & \cdots & \frac{\partial F_1}{\partial a_n} \\ \vdots & \ddots & \vdots \\ \frac{\partial F_m}{\partial a_1} & \cdots & \frac{\partial F_m}{\partial a_n} \end{bmatrix} \right|_{\mathbf{a}\; = \; \mathbf{x}} \; .$

jacobian' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R}^m \times \mathbb{R}^{m \times n})}$$
 1:  jacobian' f x 

The original value and the Jacobian of a vector-to-vector function f, at the point x.

jacobianv : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}^m}$$
 1:  jacobianv f x v 

The Jacobian-vector product of a vector-to-vector function f, at the point x, along the vector v.

For a function $$\mathbf{F}: \mathbb{R}^n \to \mathbb{R}^m$$, and $$\mathbf{x}, \mathbf{v} \in \mathbb{R}^n$$, this gives matrix product of the Jacobian of $$\mathbf{F}$$ at $$\mathbf{x}$$ with $$\mathbf{v}$$

$\left( \mathbf{J}_\mathbf{F} \right)_\mathbf{x} \mathbf{v} \; .$

This value can be computed efficiently by the DiffSharp.AD.Forward module in one forward evaluation of the function, in a matrix-free way (without computing the full Jacobian matrix).

jacobianv' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R}^m \times \mathbb{R}^m)}$$
 1:  jacobianv' f x v 

The original value and the Jacobian-vector product of a vector-to-vector function f, at the point x, along the vector v.

jacobianT : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}^{n \times m}}$$
 1:  jacobianT f x 

The transposed Jacobian of a vector-to-vector function f, at the point x.

For a function $$\mathbf{F}: \mathbb{R}^n \to \mathbb{R}^m$$ with components $$F_1 (a_1, \dots, a_n), \dots, F_m (a_1, \dots, a_n)$$, and $$\mathbf{x} \in \mathbb{R}^n$$, this gives the $$n$$-by-$$m$$ transposed Jacobian matrix evaluated at $$\mathbf{x}$$

$\left( \mathbf{J}_\mathbf{F}^\textrm{T} \right)_\mathbf{x} = \left. \begin{bmatrix} \frac{\partial F_1}{\partial a_1} & \cdots & \frac{\partial F_m}{\partial a_1} \\ \vdots & \ddots & \vdots \\ \frac{\partial F_1}{\partial a_n} & \cdots & \frac{\partial F_m}{\partial a_n} \end{bmatrix} \right|_{\mathbf{a}\; = \; \mathbf{x}} \; .$

jacobianT' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R}^m \times \mathbb{R}^{n \times m})}$$
 1:  jacobianT' f x 

The original value and the transposed Jacobian of a vector-to-vector function f, at the point x.

jacobianTv : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n \to \mathbb{R}^m} \to \color{blue}{\mathbb{R}^n}$$
 1:  jacobianTv f x v 

The transposed Jacobian-vector product of a vector-to-vector function f, at the point x, along the vector v.

For a function $$\mathbf{F}: \mathbb{R}^n \to \mathbb{R}^m$$, $$\mathbf{x} \in \mathbb{R}^n$$, and $$\mathbf{v} \in \mathbb{R}^m$$, this gives the matrix product of the transposed Jacobian of $$\mathbf{F}$$ at $$\mathbf{x}$$ with $$\mathbf{v}$$

$\left( \mathbf{J}_\mathbf{F}^\textrm{T} \right)_\mathbf{x} \mathbf{v} \; .$

This value can be computed efficiently by the DiffSharp.AD.Reverse module in one forward and one reverse evaluation of the function, in a matrix-free way (without computing the full Jacobian matrix).

jacobianTv' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n \to \mathbb{R}^m} \to \color{blue}{(\mathbb{R}^m \times \mathbb{R}^n)}$$
 1:  jacobianTv' f x v 

The original value and the transposed Jacobian-vector product of a vector-to-vector function f, at the point x, along the vector v.

jacobianTv'' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^m) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R}^m \times (\mathbb{R}^m \to \mathbb{R}^n))}$$
 1:  jacobianTv'' f x 

The original value and a function for evaluating the transposed Jacobian-vector product of a vector-to-vector function f, at point x.

Of the returned pair, the first is the original value of f at the point x (the result of the forward pass of the reverse mode AD) and the second is a function (the reverse evaluator) that can be used to compute the transposed Jacobian-vector product many times along many different vectors (performing a new reverse pass of the reverse mode AD, with the given vector, without repeating the forward pass).

This can be computed efficiently by the DiffSharp.AD.Reverse module in a matrix-free way (without computing the full Jacobian matrix).

curl : $$\color{red}{(\mathbb{R}^3 \to \mathbb{R}^3) \to \mathbb{R}^3} \to \color{blue}{\mathbb{R}^3}$$
 1:  curl f x 

The curl of a vector-to-vector function f, at the point x.

For a function $$\mathbf{F}: \mathbb{R}^3 \to \mathbb{R}^3$$ with components $$F_1(a_1, a_2, a_3),\; F_2(a_1, a_2, a_3),\; F_3(a_1, a_2, a_3)$$, and $$\mathbf{x} \in \mathbb{R}^3$$, this gives

$\left( \textrm{curl} \, \mathbf{F} \right)_{\mathbf{x}} = \left( \nabla \times \mathbf{F} \right)_{\mathbf{x}}= \left. \left[ \frac{\partial F_3}{\partial a_2} - \frac{\partial F_2}{\partial a_3}, \; \frac{\partial F_1}{\partial a_3} - \frac{\partial F_3}{\partial a_1}, \; \frac{\partial F_2}{\partial a_1} - \frac{\partial F_1}{\partial a_2} \right] \right|_{\mathbf{a}\; = \; \mathbf{x}} \; .$

curl' : $$\color{red}{(\mathbb{R}^3 \to \mathbb{R}^3) \to \mathbb{R}^3} \to \color{blue}{(\mathbb{R}^3 \times \mathbb{R}^3)}$$
 1:  curl' f x 

The original value and the curl of a vector-to-vector function f, at the point x.

div : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^n) \to \mathbb{R}^n} \to \color{blue}{\mathbb{R}}$$
 1:  div f x 

The divergence of a vector-to-vector function f, at the point x.

For a function $$\mathbf{F}: \mathbb{R}^n \to \mathbb{R}^n$$ with components $$F_1(a_1, \dots, a_n),\; \dots, \; F_n(a_1, \dots, a_n)$$, and $$\mathbf{x} \in \mathbb{R}^n$$, this gives

$\left( \textrm{div} \, \mathbf{F} \right)_{\mathbf{x}} = \left( \nabla \cdot \mathbf{F} \right)_{\mathbf{x}} = \textrm{tr}\left( \mathbf{J}_{\mathbf{F}} \right)_{\mathbf{x}} = \left. \left( \frac{\partial F_1}{\partial a_1} + \dots + \frac{\partial F_n}{\partial a_n}\right) \right|_{\mathbf{a}\; = \; \mathbf{x}} \; ,$

which is the trace of the Jacobian matrix evaluated at $$\mathbf{x}$$.

div' : $$\color{red}{(\mathbb{R}^n \to \mathbb{R}^n) \to \mathbb{R}^n} \to \color{blue}{(\mathbb{R}^n \times \mathbb{R})}$$
 1:  div' f x 

The original value and the divergence of a vector-to-vector function f, at the point x.

curldiv : $$\color{red}{(\mathbb{R}^3 \to \mathbb{R}^3) \to \mathbb{R}^3} \to \color{blue}{(\mathbb{R}^3 \times \mathbb{R})}$$
 1:  curldiv f x 

The curl and the divergence of a vector-to-vector function f, at the point x.

curldiv' : $$\color{red}{(\mathbb{R}^3 \to \mathbb{R}^3) \to \mathbb{R}^3} \to \color{blue}{(\mathbb{R}^3 \times \mathbb{R}^3 \times \mathbb{R})}$$
 1:  curldiv' f x 

The original value, the curl, and the divergence of a vector-to-vector function f, at the point x.

Linear Algebra Operations

The library provides the D, DV, and DM types for scalar, vector, and matrix values. The underlying computations when using these types are performed by a high-performance linear algebra backend, which by default uses OpenBLAS for BLAS/LAPACK operations and specialized parallel implementations for non-BLAS operations.

The following sections show only a small selection of operations commonly used with these types. For a full list of supported operations, please see the API Reference.

Vector Operations

Creating Vectors

 1: 2: 3: 4: 5: 6: 7:  open DiffSharp.AD.Float64 open DiffSharp.Util let v = toDV [1.; 2.; 3.] // Create DV from sequence of floats let v = DV.zeroCreate 3 // Create DV of length 3, elements zero let v = DV.create 3 1. // Create DV of length 3, each element with value 1. let v = DV.init 3 f // Create DV of length 3, compute elements by function f:int->float 

Basic Operations

  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39:  let v = v1 + v2 // Vector addition let v = v1 - v2 // Vector subtraction let v = v1 * v2 // Vector inner (dot, scalar) product let v = v1 &* v2 // Vector outer (dyadic, tensor) product let v = v1 .* v2 // Element-wise (Hadamard) product let v = v1 ./ v2 // Element-wise division let v = v1 ** v2 // Element-wise exponentiation let v = atan2 v1 v2 // Element-wise atan2 let v = v1 + 2. // Add scalar to vector let v = v1 - 2. // Subtract scalar from vector let v = 2. - v1 // Subtract each element of vector from scalar let v = v1 * 2. // Vector-scalar multiplication let v = v1 / 2. // Vector-scalar division let v = 2. / v1 // Divide scalar by each element of vector let v = -v1 // Unary negation let v = log v1 let v = log10 v1 let v = exp v1 let v = sin v1 let v = cos v1 let v = tan v1 let v = sqrt v1 let v = sinh v1 let v = cosh v1 let v = tanh v1 let v = asin v1 let v = acos v1 let v = atan v1 let v = abs v1 let v = signum v1 let v = floor v1 let v = ceil v1 let v = round v1 let v = softmax v1 let v = softplus v1 let v = softsign v1 let v = logsumexp v1 let v = sigmoid v1 let v = reLU v1 

Vector Norms

 1: 2: 3:  let s = DV.l1norm v1 // L1 norm let s = DV.l2norm v1 // L2 norm let s = DV.l2normSq v1 // Squared L2 norm 

Accessing Elements & Conversions

 1: 2: 3: 4: 5: 6: 7: 8:  let s = v1.[0] // Element 0 let v = v1.[..1] // Slice of v1, until element 1 let v = v1.[1..2] // Slice of v2, between elements 1 and 2 let v = DV [|1.; 2.; 3.|] // Create DV from float[] let v = toDV [|1.; 2.; 3.|] // Create DV from sequence of floats let v = toDV [1.; 2.; 3.] // Create DV from sequence of floats let v = toDV [D 1.; D 2.; D 3.] // Create DV from sequence of Ds let a:float[] = convert v1 // Convert DV to array of floats 

Splitting and Concatenating

 1: 2: 3:  let vs = DV.splitEqual 3 (toDV [1.; 2.; 3.; 4.; 5.; 6.]) // Split DV into 3 vectors of equal length let vs = DV.split [2; 4] (toDV [1.; 2.; 3.; 4.; 5.; 6.]) // Split DV into vectors of given lengths let v = DV.concat ss // Concatenate sequence of DVs into one 

Mathematica and MATLAB Strings

 1: 2:  let st = v1.ToMathematicaString() let st = v1.ToMatlabString() 

Other Operations

 1: 2: 3: 4: 5: 6:  let s = DV.length v1 // Length of DV let s = DV.min v1 // Minimum element of DV let s = DV.max v1 // Maximum element of DV let s = DV.sum v1 // Sum of elements of DV let v = DV.unitVector v1 // Unit vector codirectional with v1 let v = DV.normalize v1 // Normalize elements to have zero mean and unit variance 

Matrix Operations

Creating Matrices

 1: 2: 3: 4: 5: 6: 7: 8: 9:  open DiffSharp.AD.Float64 open DiffSharp.Util let m = toDM [[1.; 2.]; [3.; 4.]] // Create DM from sequence of sequences of floats let m = DM.zeroCreate 2 2 // Create DM of size 2x2, each element zero let m = DM.create 2 2 1. // Create DM of size 2x2, each element with value 1. let m = DM.init 2 2 f // Create DM of size 2x2, compute elements by function f:int->int->float let m = DM.initRows 2 f // Create DM of 2 rows, init rows by function f:int->DV let m = DM.initCols 2 f // Create DM of 2 rows, init columns by function f:int->DV 

Basic Operations

  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40:  let m = m1 + m2 // Matrix addition let m = m1 - m2 // Matrix subtraction let m = m1 * m2 // Matrix multiplication let m = m1 .* m2 // Element-wise (Hadamard) product let m = m1 ./ m2 // Element-wise division let m = m1 ** m2 // Element-wise exponentiation let m = atan2 m1 m2 // Element-wise atan2 let m = m1 * v // Matrix-vector product let m = v * m1 // Vector-matrix product let m = m1 + 2. // Add scalar to matrix let m = m1 - 2. // Subtract scalar from matrix let m = 2. - m1 // Subtract each element of matrix from scalar let m = m1 * 2. // Matrix-scalar multiplication let m = m1 / 2. // Matrix-scalar division let m = 2. / m1 // Divide scalar by each element of matrix let m = -m1 let m = log m1 let m = log10 m1 let m = exp m1 let m = sin m1 let m = cos m1 let m = tan m1 let m = sqrt m1 let m = sinh m1 let m = cosh m1 let m = tanh m1 let m = asin m1 let m = acos m1 let m = atan m1 let m = abs m1 let m = signum m1 let m = floor m1 let m = ceil m1 let m = round m1 let m = softplus m1 let m = softsign m1 let m = sigmoid m1 let m = reLU m1 

Matrix Operations

 1: 2: 3: 4: 5: 6: 7:  let s = DM.det m1 // Determinant let m = DM.inverse m1 // Inverse let m = DM.transpose m1 // Transpose let s = DM.trace m1 // Trace let v = DM.diagonal m1 // Diagonal let x = DM.solve m1 v // Solve system of linear equations let x = DM.solveSymmetric m1 v // Solve system of linear equations (symmetric) 

Accessing Elements & Conversions

  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:  let s = m1.[0, 0] // Element at 0, 0 let m = m1.[0..1, 1..] // Slice, between rows 0 and 1, columns 1 and beyond let m = m1.[*, 0..1] // Slice, all rows, between columns 0 and 1 let v = m1.[0, *] // Slice, row 0 as a DV let v = m1.[*, 1] // Slice, column 1 as a DV let vs = DM.toRows m1 // Return all rows as a sequence of DVs let m = DM.ofRows [toDV [1.; 2.]; toDV [3.; 4.]] // Create matrix from row vectors let vs = DM.toCols m1 // Return all columns as a sequence of DVs let m = DM.ofCols [toDV [1.; 3.]; toDV [2.; 4.]] // Create matrix from column vectors let m = DM (array2D [[1.; 2.]; [3.; 4.]]) // Create DM from float[,] let m = toDM [|[|1.; 2.|]; [|3.; 4.|]|] // Create DM from sequence of sequences of floats let m = toDM [[1.; 2.]; [3.; 4.]] // Create DM from sequence of sequences of floats let m = toDM [[D 1.; D 2.]; [D 3.; D 4.]] // Create DM from sequence of sequences of Ds let v = DM.toVector m1 // Convert DM to DV by stacking rows of matrix let m = DM.ofVector 2 v2 // Convert DV to a DM with a given number of rows let m = DM.appendRow v m // Append row to matrix let m = DM.prependRow v m // Prepend row to matrix let m = DM.appendCol v m // Append column to matrix let m = DM.prependCol v m // Prepend column to matrix let a:float[,] = convert m1 // Convert DM to float[,] 

Mathematica and MATLAB Strings

 1: 2:  let st = m1.ToMathematicaString() let st = m1.ToMatlabString() 

Other Operations

 1: 2: 3: 4: 5: 6: 7: 8: 9:  let s = DM.rows m1 // Number of rows let s = DM.cols m1 // Number of columns let s = DM.length m1 // Total number of elements let s = DM.min m1 // Minimum element of DM let s = DM.max m1 // Maximum element of DM let s = DM.sum m1 // Sum of elements of DM let m = DM.normalize // Normalize elements to have zero mean and unit variance let m = DM.mapRows f m1 // Map function f:DV->DV to rows of matrix let m = DM.mapCols f m1 // Map function f:DV->DV to columns of matrix 

Visualizations

The library provides visualization functionality for the DV and DM types that can be useful in an interactive console environment. The visualizations are normalized, meaning they map the full range of data to the full range of visual intensity.

  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:  open DiffSharp.AD.Float64 // Create a vector let v = DV.init 40 (fun i -> sin ((float i) /2.)) // Create a matrix let m = DM.init 20 20 (fun i j -> 1. / exp (((float i) ** 2. + (float j) ** 2.) / 400.)) // Visualize and print to console v |> DV.visualize |> printfn "%s" m |> DM.visualize |> printfn "%s" 
  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:  DV : 40 ▴●■■■♦▪· -▪♦■■■●▴· ·▴●■■■♦▪- ·▪♦ DM : 20 x 20 ■■■■■■■♦♦♦●●▪▪▴▴---· ■■■■■■■♦♦♦●●▪▪▴▴---· ■■■■■■♦♦♦●●●▪▪▴▴--·· ■■■■■■♦♦♦●●●▪▪▴▴--·· ■■■■■♦♦♦♦●●▪▪▪▴▴--·· ■■■■♦♦♦♦●●●▪▪▴▴---·· ■■♦♦♦♦♦●●●▪▪▪▴▴---·· ♦♦♦♦♦♦●●●●▪▪▴▴▴--··· ♦♦♦♦♦●●●●▪▪▪▴▴---·· ♦♦●●●●●●▪▪▪▴▴---··· ●●●●●●▪▪▪▪▴▴▴---·· ●●●●▪▪▪▪▪▴▴▴---··· ▪▪▪▪▪▪▪▴▴▴▴---··· ▪▪▪▪▪▴▴▴▴----··· ▴▴▴▴▴▴▴▴----··· ▴▴▴▴▴------··· ---------···· -------····· --········ ········ 

There is a global configuration setting for changing the contrast of visualizations, using DiffSharp.Config.GlobalConfig.SetVisualizationContrast.

 1:  DiffSharp.Config.GlobalConfig.SetVisualizationContrast(9.) 
  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:  DV : 40 ▴██████ ██████ ██████ ██ DM : 20 x 20 ██████████████♦- ██████████████♦- ██████████████●· ██████████████●· ██████████████▪ █████████████♦- █████████████●· ████████████♦▴ ████████████▪· ███████████●- ██████████●- █████████●- ███████♦▪- █████♦●▴· ♦♦●●▪-· --·· 

The visualization palette uses Unicode symbols by default. You can change it to an ASCII palette if you prefer so, or if your console font does not render the Unicode palette correctly.

 1: 2: 3: 4: 5: 6: 7: 8: 9:  // The default Unicode palette DiffSharp.Config.GlobalConfig.SetVisualizationPalette("Unicode") // The ASCII palette DiffSharp.Config.GlobalConfig.SetVisualizationPalette("ASCII") DiffSharp.Config.GlobalConfig.SetVisualizationContrast(1.) v |> DV.visualize |> printfn "%s" m |> DM.visualize |> printfn "%s" 
  1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24:  DV : 40 TXNNNXY: :YHNNHVT. .TVHNNHY: :YX DM : 20 x 20 NNNNNNHHHXXVVYTTxx:: NNNNNNHHHXXVYYTTxx:: NNNNNNHHXXVVYYTTxx:: NNNNNHHHXXVVYYTTxx:: NNNNHHHHXXVVYYTTx::. NNNHHHHXXVVYYTTxx::. HHHHHHXXXVVYYTTxx::. HHHHHXXXVVYYTTxx:::. HHXXXXXVVYYYTTxx::.. XXXXXVVVYYYTTxx:::.. XXVVVVVYYYTTxxx::.. VVVVVYYYYTTTxx::... VYYYYYYTTTxxx:::.. YYYYYTTTTxxx:::... TTTTTTTxxxx:::... TTTTTxxxx::::... xxxxxxx::::.... xxxx::::::.... ::::::::.... ::::...... 
namespace DiffSharp
module Float64

val a : D

Full name: Api-overview.a
val diff : f:(D -> 'c) -> x:D -> 'c (requires member get_P and member get_T)

val x : D
val sin : value:'T -> 'T (requires member Sin)

Full name: Microsoft.FSharp.Core.Operators.sin
val sqrt : value:'T -> 'U (requires member Sqrt)

Full name: Microsoft.FSharp.Core.Operators.sqrt
union case D.D: float -> D
val b : D

Full name: Api-overview.b
val c : D

Full name: Api-overview.c
val diff' : f:(D -> 'a) -> x:D -> 'a * 'a (requires member get_T and member get_P)

val printf : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printf
val diff2 : f:(D -> 'c) -> x:D -> 'c (requires member get_P and member get_T)

val diff2' : f:(D -> 'a) -> x:D -> 'a * 'a (requires member get_T and member get_P)

val diff2'' : f:(D -> 'a) -> x:D -> 'a * 'a * 'a (requires member get_T and member get_P)

val diffn : n:int -> f:(D -> 'c) -> x:D -> 'c (requires member get_P and member get_T)

val diffn' : n:int -> f:(D -> 'a) -> x:D -> 'a * 'a (requires member get_P and member get_T)

val grad : f:('c -> D) -> x:'c -> 'c (requires member GetReverse and member get_A)

val grad' : f:('a -> D) -> x:'a -> D * 'a (requires member get_A and member GetReverse)

val gradv : f:('c -> 'd) -> x:'c -> v:'c -> 'd (requires member GetForward and member get_P and member get_T)

val gradv' : f:('a -> 'b) -> x:'a -> v:'a -> 'b * 'b (requires member GetForward and member get_T and member get_P)

val hessian : f:(DV -> D) -> x:DV -> DM

val hessian' : f:(DV -> D) -> x:DV -> D * DM

val hessianv : f:('c -> D) -> x:'c -> v:'c -> 'c (requires member GetReverse and member get_A and member GetForward)

val hessianv' : f:('a -> D) -> x:'a -> v:'a -> D * 'a (requires member GetReverse and member get_A and member GetForward)

val gradhessian : f:(DV -> D) -> x:DV -> DV * DM

val gradhessian' : f:(DV -> D) -> x:DV -> D * DV * DM

val gradhessianv : f:('a -> D) -> x:'a -> v:'a -> D * 'a (requires member GetReverse and member get_A and member GetForward)

val gradhessianv' : f:('a -> D) -> x:'a -> v:'a -> D * D * 'a (requires member GetReverse and member get_A and member GetForward)

val laplacian : f:(DV -> D) -> x:DV -> D

val laplacian' : f:(DV -> D) -> x:DV -> D * D

val jacobian : f:(DV -> DV) -> x:DV -> DM

val jacobian' : f:(DV -> DV) -> x:DV -> DV * DM

val jacobianv : f:('c -> 'd) -> x:'c -> v:'c -> 'd (requires member GetForward and member get_P and member get_T)

val jacobianv' : f:('a -> 'b) -> x:'a -> v:'a -> 'b * 'b (requires member GetForward and member get_T and member get_P)

val jacobianT : f:(DV -> DV) -> x:DV -> DM

val jacobianT' : f:(DV -> DV) -> x:DV -> DV * DM

val jacobianTv : f:('c -> 'd) -> x:'c -> v:'d -> 'c (requires member get_A and member GetReverse and member get_P)

val jacobianTv' : f:('a -> 'b) -> x:'a -> v:'b -> 'b * 'a (requires member GetReverse and member get_A and member get_P)

val jacobianTv'' : f:('a -> 'b) -> x:'a -> 'b * ('b -> 'a) (requires member GetReverse and member get_A and member get_P)

val curl : f:(DV -> DV) -> x:DV -> DV

val curl' : f:(DV -> DV) -> x:DV -> DV * DV

val div : f:(DV -> DV) -> x:DV -> D

val div' : f:(DV -> DV) -> x:DV -> DV * D

val curldiv : f:(DV -> DV) -> x:DV -> DV * D

val curldiv' : f:(DV -> DV) -> x:DV -> DV * DV * D

module Util

from DiffSharp
val v : DV

Full name: Api-overview.v
val toDV : v:seq<'a> -> DV (requires member op_Explicit)

Multiple items
union case DV.DV: float [] -> DV

--------------------
module DV

--------------------
type DV =
| DV of float []
| DVF of DV * DV * uint32
| DVR of DV * DV ref * TraceOp * uint32 ref * uint32
member Copy : unit -> DV
member GetForward : t:DV * i:uint32 -> DV
member GetReverse : i:uint32 -> DV
member GetSlice : lower:int option * upper:int option -> DV
member ToArray : unit -> D []
member ToColDM : unit -> DM
member ToMathematicaString : unit -> string
member ToMatlabString : unit -> string
member ToRowDM : unit -> DM
override ToString : unit -> string
member Visualize : unit -> string
member A : DV
member F : uint32
member Item : i:int -> D with get
member Length : int
member P : DV
member PD : DV
member T : DV
member A : DV with set
member F : uint32 with set
static member Abs : a:DV -> DV
static member Acos : a:DV -> DV
static member AddItem : a:DV * i:int * b:D -> DV
static member AddSubVector : a:DV * i:int * b:DV -> DV
static member Append : a:DV * b:DV -> DV
static member Asin : a:DV -> DV
static member Atan : a:DV -> DV
static member Atan2 : a:int * b:DV -> DV
static member Atan2 : a:DV * b:int -> DV
static member Atan2 : a:float * b:DV -> DV
static member Atan2 : a:DV * b:float -> DV
static member Atan2 : a:D * b:DV -> DV
static member Atan2 : a:DV * b:D -> DV
static member Atan2 : a:DV * b:DV -> DV
static member Ceiling : a:DV -> DV
static member Cos : a:DV -> DV
static member Cosh : a:DV -> DV
static member Exp : a:DV -> DV
static member Floor : a:DV -> DV
static member L1Norm : a:DV -> D
static member L2Norm : a:DV -> D
static member L2NormSq : a:DV -> D
static member Log : a:DV -> DV
static member Log10 : a:DV -> DV
static member LogSumExp : a:DV -> D
static member Max : a:DV -> D
static member Max : a:D * b:DV -> DV
static member Max : a:DV * b:D -> DV
static member Max : a:DV * b:DV -> DV
static member MaxIndex : a:DV -> int
static member Mean : a:DV -> D
static member Min : a:DV -> D
static member Min : a:D * b:DV -> DV
static member Min : a:DV * b:D -> DV
static member Min : a:DV * b:DV -> DV
static member MinIndex : a:DV -> int
static member Normalize : a:DV -> DV
static member OfArray : a:D [] -> DV
static member Op_DV_D : a:DV * ff:(float [] -> float) * fd:(DV -> D) * df:(D * DV * DV -> D) * r:(DV -> TraceOp) -> D
static member Op_DV_DM : a:DV * ff:(float [] -> float [,]) * fd:(DV -> DM) * df:(DM * DV * DV -> DM) * r:(DV -> TraceOp) -> DM
static member Op_DV_DV : a:DV * ff:(float [] -> float []) * fd:(DV -> DV) * df:(DV * DV * DV -> DV) * r:(DV -> TraceOp) -> DV
static member Op_DV_DV_D : a:DV * b:DV * ff:(float [] * float [] -> float) * fd:(DV * DV -> D) * df_da:(D * DV * DV -> D) * df_db:(D * DV * DV -> D) * df_dab:(D * DV * DV * DV * DV -> D) * r_d_d:(DV * DV -> TraceOp) * r_d_c:(DV * DV -> TraceOp) * r_c_d:(DV * DV -> TraceOp) -> D
static member Op_DV_DV_DM : a:DV * b:DV * ff:(float [] * float [] -> float [,]) * fd:(DV * DV -> DM) * df_da:(DM * DV * DV -> DM) * df_db:(DM * DV * DV -> DM) * df_dab:(DM * DV * DV * DV * DV -> DM) * r_d_d:(DV * DV -> TraceOp) * r_d_c:(DV * DV -> TraceOp) * r_c_d:(DV * DV -> TraceOp) -> DM
static member Op_DV_DV_DV : a:DV * b:DV * ff:(float [] * float [] -> float []) * fd:(DV * DV -> DV) * df_da:(DV * DV * DV -> DV) * df_db:(DV * DV * DV -> DV) * df_dab:(DV * DV * DV * DV * DV -> DV) * r_d_d:(DV * DV -> TraceOp) * r_d_c:(DV * DV -> TraceOp) * r_c_d:(DV * DV -> TraceOp) -> DV
static member Op_DV_D_DV : a:DV * b:D * ff:(float [] * float -> float []) * fd:(DV * D -> DV) * df_da:(DV * DV * DV -> DV) * df_db:(DV * D * D -> DV) * df_dab:(DV * DV * DV * D * D -> DV) * r_d_d:(DV * D -> TraceOp) * r_d_c:(DV * D -> TraceOp) * r_c_d:(DV * D -> TraceOp) -> DV
static member Op_D_DV_DV : a:D * b:DV * ff:(float * float [] -> float []) * fd:(D * DV -> DV) * df_da:(DV * D * D -> DV) * df_db:(DV * DV * DV -> DV) * df_dab:(DV * D * D * DV * DV -> DV) * r_d_d:(D * DV -> TraceOp) * r_d_c:(D * DV -> TraceOp) * r_c_d:(D * DV -> TraceOp) -> DV
static member Pow : a:int * b:DV -> DV
static member Pow : a:DV * b:int -> DV
static member Pow : a:float * b:DV -> DV
static member Pow : a:DV * b:float -> DV
static member Pow : a:D * b:DV -> DV
static member Pow : a:DV * b:D -> DV
static member Pow : a:DV * b:DV -> DV
static member ReLU : a:DV -> DV
static member ReshapeToDM : m:int * a:DV -> DM
static member Round : a:DV -> DV
static member Sigmoid : a:DV -> DV
static member Sign : a:DV -> DV
static member Sin : a:DV -> DV
static member Sinh : a:DV -> DV
static member SoftMax : a:DV -> DV
static member SoftPlus : a:DV -> DV
static member SoftSign : a:DV -> DV
static member Split : d:DV * n:seq<int> -> seq<DV>
static member Sqrt : a:DV -> DV
static member StandardDev : a:DV -> D
static member Standardize : a:DV -> DV
static member Sum : a:DV -> D
static member Tan : a:DV -> DV
static member Tanh : a:DV -> DV
static member Variance : a:DV -> D
static member ZeroN : n:int -> DV
static member Zero : DV
static member ( + ) : a:int * b:DV -> DV
static member ( + ) : a:DV * b:int -> DV
static member ( + ) : a:float * b:DV -> DV
static member ( + ) : a:DV * b:float -> DV
static member ( + ) : a:D * b:DV -> DV
static member ( + ) : a:DV * b:D -> DV
static member ( + ) : a:DV * b:DV -> DV
static member ( &* ) : a:DV * b:DV -> DM
static member ( / ) : a:int * b:DV -> DV
static member ( / ) : a:DV * b:int -> DV
static member ( / ) : a:float * b:DV -> DV
static member ( / ) : a:DV * b:float -> DV
static member ( / ) : a:D * b:DV -> DV
static member ( / ) : a:DV * b:D -> DV
static member ( ./ ) : a:DV * b:DV -> DV
static member ( .* ) : a:DV * b:DV -> DV
static member op_Explicit : d:float [] -> DV
static member op_Explicit : d:DV -> float []
static member ( * ) : a:int * b:DV -> DV
static member ( * ) : a:DV * b:int -> DV
static member ( * ) : a:float * b:DV -> DV
static member ( * ) : a:DV * b:float -> DV
static member ( * ) : a:D * b:DV -> DV
static member ( * ) : a:DV * b:D -> DV
static member ( * ) : a:DV * b:DV -> D
static member ( - ) : a:int * b:DV -> DV
static member ( - ) : a:DV * b:int -> DV
static member ( - ) : a:float * b:DV -> DV
static member ( - ) : a:DV * b:float -> DV
static member ( - ) : a:D * b:DV -> DV
static member ( - ) : a:DV * b:D -> DV
static member ( - ) : a:DV * b:DV -> DV
static member ( ~- ) : a:DV -> DV

val zeroCreate : n:int -> DV

val create : n:int -> v:'a -> DV

val init : n:int -> f:(int -> 'a) -> DV

val v : 'a (requires member ( + ))

Full name: Api-overview.v
val v : 'a (requires member ( - ))

Full name: Api-overview.v
val v : 'a (requires member ( * ))

Full name: Api-overview.v
val v : '_arg3

Full name: Api-overview.v
val v : float

Full name: Api-overview.v
val v : 'a

Full name: Api-overview.v
val atan2 : y:'T1 -> x:'T1 -> 'T2 (requires member Atan2)

Full name: Microsoft.FSharp.Core.Operators.atan2
val v : int

Full name: Api-overview.v
val log : value:'T -> 'T (requires member Log)

Full name: Microsoft.FSharp.Core.Operators.log
val log10 : value:'T -> 'T (requires member Log10)

Full name: Microsoft.FSharp.Core.Operators.log10
val exp : value:'T -> 'T (requires member Exp)

Full name: Microsoft.FSharp.Core.Operators.exp
val cos : value:'T -> 'T (requires member Cos)

Full name: Microsoft.FSharp.Core.Operators.cos
val tan : value:'T -> 'T (requires member Tan)

Full name: Microsoft.FSharp.Core.Operators.tan
val sinh : value:'T -> 'T (requires member Sinh)

Full name: Microsoft.FSharp.Core.Operators.sinh
val cosh : value:'T -> 'T (requires member Cosh)

Full name: Microsoft.FSharp.Core.Operators.cosh
val tanh : value:'T -> 'T (requires member Tanh)

Full name: Microsoft.FSharp.Core.Operators.tanh
val asin : value:'T -> 'T (requires member Asin)

Full name: Microsoft.FSharp.Core.Operators.asin
val acos : value:'T -> 'T (requires member Acos)

Full name: Microsoft.FSharp.Core.Operators.acos
val atan : value:'T -> 'T (requires member Atan)

Full name: Microsoft.FSharp.Core.Operators.atan
val abs : value:'T -> 'T (requires member Abs)

Full name: Microsoft.FSharp.Core.Operators.abs
val v : 'a (requires member Sign)

Full name: Api-overview.v
val signum : x:'a -> 'a (requires member Sign)

Full name: DiffSharp.Util.signum
val floor : value:'T -> 'T (requires member Floor)

Full name: Microsoft.FSharp.Core.Operators.floor
val ceil : value:'T -> 'T (requires member Ceiling)

Full name: Microsoft.FSharp.Core.Operators.ceil
val round : value:'T -> 'T (requires member Round)

Full name: Microsoft.FSharp.Core.Operators.round
val v : 'a (requires member SoftMax)

Full name: Api-overview.v
val softmax : x:'a -> 'a (requires member SoftMax)

Full name: DiffSharp.Util.softmax
val v : 'a (requires member SoftPlus)

Full name: Api-overview.v
val softplus : x:'a -> 'a (requires member SoftPlus)

Full name: DiffSharp.Util.softplus
val v : 'a (requires member SoftSign)

Full name: Api-overview.v
val softsign : x:'a -> 'a (requires member SoftSign)

Full name: DiffSharp.Util.softsign
val logsumexp : x:'a -> 'b (requires member LogSumExp)

Full name: DiffSharp.Util.logsumexp
val v : 'a (requires member Sigmoid)

Full name: Api-overview.v
val sigmoid : x:'a -> 'a (requires member Sigmoid)

Full name: DiffSharp.Util.sigmoid
val v : 'a (requires member ReLU)

Full name: Api-overview.v
val reLU : x:'a -> 'a (requires member ReLU)

Full name: DiffSharp.Util.reLU
val s : D

Full name: Api-overview.s
val l1norm : v:DV -> D

val l2norm : v:DV -> D

val l2normSq : v:DV -> D

val s : 'a

Full name: Api-overview.s
val a : float []

Full name: Api-overview.a
Multiple items
val float : value:'T -> float (requires member op_Explicit)

Full name: Microsoft.FSharp.Core.Operators.float

--------------------
type float = System.Double

Full name: Microsoft.FSharp.Core.float

--------------------
type float<'Measure> = float

Full name: Microsoft.FSharp.Core.float<_>
val convert : v:'a -> 'b (requires member op_Explicit)

val vs : seq<DV>

Full name: Api-overview.vs
val splitEqual : n:int -> v:DV -> seq<DV>

val split : n:seq<int> -> v:DV -> seq<DV>

val concat : v:seq<DV> -> DV

val st : 'a

Full name: Api-overview.st
val s : int

Full name: Api-overview.s
val length : v:DV -> int

val min : v:DV -> D

val max : v:DV -> D

val sum : v:DV -> D

val normalize : v:DV -> DV

val m : DM

Full name: Api-overview.m
val toDM : m:seq<seq<'a>> -> DM (requires member op_Explicit)

Multiple items
union case DM.DM: float [,] -> DM

--------------------
module DM

--------------------
type DM =
| DM of float [,]
| DMF of DM * DM * uint32
| DMR of DM * DM ref * TraceOp * uint32 ref * uint32
member Copy : unit -> DM
member GetCols : unit -> seq<DV>
member GetForward : t:DM * i:uint32 -> DM
member GetReverse : i:uint32 -> DM
member GetRows : unit -> seq<DV>
member GetSlice : rowStart:int option * rowFinish:int option * col:int -> DV
member GetSlice : row:int * colStart:int option * colFinish:int option -> DV
member GetSlice : rowStart:int option * rowFinish:int option * colStart:int option * colFinish:int option -> DM
member ToMathematicaString : unit -> string
member ToMatlabString : unit -> string
override ToString : unit -> string
member Visualize : unit -> string
member A : DM
member Cols : int
member F : uint32
member Item : i:int * j:int -> D with get
member Length : int
member P : DM
member PD : DM
member Rows : int
member T : DM
member A : DM with set
member F : uint32 with set
static member Abs : a:DM -> DM
static member Acos : a:DM -> DM
static member AddDiagonal : a:DM * b:DV -> DM
static member AddItem : a:DM * i:int * j:int * b:D -> DM
static member AddSubMatrix : a:DM * i:int * j:int * b:DM -> DM
static member Asin : a:DM -> DM
static member Atan : a:DM -> DM
static member Atan2 : a:int * b:DM -> DM
static member Atan2 : a:DM * b:int -> DM
static member Atan2 : a:float * b:DM -> DM
static member Atan2 : a:DM * b:float -> DM
static member Atan2 : a:D * b:DM -> DM
static member Atan2 : a:DM * b:D -> DM
static member Atan2 : a:DM * b:DM -> DM
static member Ceiling : a:DM -> DM
static member Cos : a:DM -> DM
static member Cosh : a:DM -> DM
static member Det : a:DM -> D
static member Diagonal : a:DM -> DV
static member Exp : a:DM -> DM
static member Floor : a:DM -> DM
static member Inverse : a:DM -> DM
static member Log : a:DM -> DM
static member Log10 : a:DM -> DM
static member Max : a:DM -> D
static member Max : a:D * b:DM -> DM
static member Max : a:DM * b:D -> DM
static member Max : a:DM * b:DM -> DM
static member MaxIndex : a:DM -> int * int
static member Mean : a:DM -> D
static member Min : a:DM -> D
static member Min : a:D * b:DM -> DM
static member Min : a:DM * b:D -> DM
static member Min : a:DM * b:DM -> DM
static member MinIndex : a:DM -> int * int
static member Normalize : a:DM -> DM
static member OfArray : m:int * a:D [] -> DM
static member OfArray2D : a:D [,] -> DM
static member OfCols : n:int * a:DV -> DM
static member OfRows : s:seq<DV> -> DM
static member OfRows : m:int * a:DV -> DM
static member Op_DM_D : a:DM * ff:(float [,] -> float) * fd:(DM -> D) * df:(D * DM * DM -> D) * r:(DM -> TraceOp) -> D
static member Op_DM_DM : a:DM * ff:(float [,] -> float [,]) * fd:(DM -> DM) * df:(DM * DM * DM -> DM) * r:(DM -> TraceOp) -> DM
static member Op_DM_DM_DM : a:DM * b:DM * ff:(float [,] * float [,] -> float [,]) * fd:(DM * DM -> DM) * df_da:(DM * DM * DM -> DM) * df_db:(DM * DM * DM -> DM) * df_dab:(DM * DM * DM * DM * DM -> DM) * r_d_d:(DM * DM -> TraceOp) * r_d_c:(DM * DM -> TraceOp) * r_c_d:(DM * DM -> TraceOp) -> DM
static member Op_DM_DV : a:DM * ff:(float [,] -> float []) * fd:(DM -> DV) * df:(DV * DM * DM -> DV) * r:(DM -> TraceOp) -> DV
static member Op_DM_DV_DM : a:DM * b:DV * ff:(float [,] * float [] -> float [,]) * fd:(DM * DV -> DM) * df_da:(DM * DM * DM -> DM) * df_db:(DM * DV * DV -> DM) * df_dab:(DM * DM * DM * DV * DV -> DM) * r_d_d:(DM * DV -> TraceOp) * r_d_c:(DM * DV -> TraceOp) * r_c_d:(DM * DV -> TraceOp) -> DM
static member Op_DM_DV_DV : a:DM * b:DV * ff:(float [,] * float [] -> float []) * fd:(DM * DV -> DV) * df_da:(DV * DM * DM -> DV) * df_db:(DV * DV * DV -> DV) * df_dab:(DV * DM * DM * DV * DV -> DV) * r_d_d:(DM * DV -> TraceOp) * r_d_c:(DM * DV -> TraceOp) * r_c_d:(DM * DV -> TraceOp) -> DV
static member Op_DM_D_DM : a:DM * b:D * ff:(float [,] * float -> float [,]) * fd:(DM * D -> DM) * df_da:(DM * DM * DM -> DM) * df_db:(DM * D * D -> DM) * df_dab:(DM * DM * DM * D * D -> DM) * r_d_d:(DM * D -> TraceOp) * r_d_c:(DM * D -> TraceOp) * r_c_d:(DM * D -> TraceOp) -> DM
static member Op_DV_DM_DM : a:DV * b:DM * ff:(float [] * float [,] -> float [,]) * fd:(DV * DM -> DM) * df_da:(DM * DV * DV -> DM) * df_db:(DM * DM * DM -> DM) * df_dab:(DM * DV * DV * DM * DM -> DM) * r_d_d:(DV * DM -> TraceOp) * r_d_c:(DV * DM -> TraceOp) * r_c_d:(DV * DM -> TraceOp) -> DM
static member Op_DV_DM_DV : a:DV * b:DM * ff:(float [] * float [,] -> float []) * fd:(DV * DM -> DV) * df_da:(DV * DV * DV -> DV) * df_db:(DV * DM * DM -> DV) * df_dab:(DV * DV * DV * DM * DM -> DV) * r_d_d:(DV * DM -> TraceOp) * r_d_c:(DV * DM -> TraceOp) * r_c_d:(DV * DM -> TraceOp) -> DV
static member Op_D_DM_DM : a:D * b:DM * ff:(float * float [,] -> float [,]) * fd:(D * DM -> DM) * df_da:(DM * D * D -> DM) * df_db:(DM * DM * DM -> DM) * df_dab:(DM * D * D * DM * DM -> DM) * r_d_d:(D * DM -> TraceOp) * r_d_c:(D * DM -> TraceOp) * r_c_d:(D * DM -> TraceOp) -> DM
static member Pow : a:int * b:DM -> DM
static member Pow : a:DM * b:int -> DM
static member Pow : a:float * b:DM -> DM
static member Pow : a:DM * b:float -> DM
static member Pow : a:D * b:DM -> DM
static member Pow : a:DM * b:D -> DM
static member Pow : a:DM * b:DM -> DM
static member ReLU : a:DM -> DM
static member ReshapeToDV : a:DM -> DV
static member Round : a:DM -> DM
static member Sigmoid : a:DM -> DM
static member Sign : a:DM -> DM
static member Sin : a:DM -> DM
static member Sinh : a:DM -> DM
static member SoftPlus : a:DM -> DM
static member SoftSign : a:DM -> DM
static member Solve : a:DM * b:DV -> DV
static member SolveSymmetric : a:DM * b:DV -> DV
static member Sqrt : a:DM -> DM
static member StandardDev : a:DM -> D
static member Standardize : a:DM -> DM
static member Sum : a:DM -> D
static member Tan : a:DM -> DM
static member Tanh : a:DM -> DM
static member Trace : a:DM -> D
static member Transpose : a:DM -> DM
static member Variance : a:DM -> D
static member ZeroMN : m:int -> n:int -> DM
static member Zero : DM
static member ( + ) : a:int * b:DM -> DM
static member ( + ) : a:DM * b:int -> DM
static member ( + ) : a:float * b:DM -> DM
static member ( + ) : a:DM * b:float -> DM
static member ( + ) : a:DM * b:DV -> DM
static member ( + ) : a:DV * b:DM -> DM
static member ( + ) : a:D * b:DM -> DM
static member ( + ) : a:DM * b:D -> DM
static member ( + ) : a:DM * b:DM -> DM
static member ( / ) : a:int * b:DM -> DM
static member ( / ) : a:DM * b:int -> DM
static member ( / ) : a:float * b:DM -> DM
static member ( / ) : a:DM * b:float -> DM
static member ( / ) : a:D * b:DM -> DM
static member ( / ) : a:DM * b:D -> DM
static member ( ./ ) : a:DM * b:DM -> DM
static member ( .* ) : a:DM * b:DM -> DM
static member op_Explicit : d:float [,] -> DM
static member op_Explicit : d:DM -> float [,]
static member ( * ) : a:int * b:DM -> DM
static member ( * ) : a:DM * b:int -> DM
static member ( * ) : a:float * b:DM -> DM
static member ( * ) : a:DM * b:float -> DM
static member ( * ) : a:D * b:DM -> DM
static member ( * ) : a:DM * b:D -> DM
static member ( * ) : a:DV * b:DM -> DV
static member ( * ) : a:DM * b:DV -> DV
static member ( * ) : a:DM * b:DM -> DM
static member ( - ) : a:int * b:DM -> DM
static member ( - ) : a:DM * b:int -> DM
static member ( - ) : a:float * b:DM -> DM
static member ( - ) : a:DM * b:float -> DM
static member ( - ) : a:D * b:DM -> DM
static member ( - ) : a:DM * b:D -> DM
static member ( - ) : a:DM * b:DM -> DM
static member ( ~- ) : a:DM -> DM

val zeroCreate : m:int -> n:int -> DM

val create : m:int -> n:int -> v:'a -> DM

val init : m:int -> n:int -> f:(int -> int -> 'a) -> DM

val initRows : m:int -> f:(int -> DV) -> DM

val initCols : n:int -> f:(int -> DV) -> DM

val m : 'a (requires member ( + ))

Full name: Api-overview.m
val m : 'a (requires member ( - ))

Full name: Api-overview.m
val m : 'a (requires member ( * ))

Full name: Api-overview.m
val m : '_arg3

Full name: Api-overview.m
val m : float

Full name: Api-overview.m
val m : 'a

Full name: Api-overview.m
val m : DV

Full name: Api-overview.m
val m : 'a (requires member ( ~- ))

Full name: Api-overview.m
val m : 'a (requires member Log)

Full name: Api-overview.m
val m : 'a (requires member Log10)

Full name: Api-overview.m
val m : 'a (requires member Exp)

Full name: Api-overview.m
val m : 'a (requires member Sin)

Full name: Api-overview.m
val m : 'a (requires member Cos)

Full name: Api-overview.m
val m : 'a (requires member Tan)

Full name: Api-overview.m
val m : 'a (requires member Sinh)

Full name: Api-overview.m
val m : 'a (requires member Cosh)

Full name: Api-overview.m
val m : 'a (requires member Tanh)

Full name: Api-overview.m
val m : 'a (requires member Asin)

Full name: Api-overview.m
val m : 'a (requires member Acos)

Full name: Api-overview.m
val m : 'a (requires member Atan)

Full name: Api-overview.m
val m : 'a (requires member Abs)

Full name: Api-overview.m
val m : 'a (requires member Sign)

Full name: Api-overview.m
val m : 'a (requires member Floor)

Full name: Api-overview.m
val m : 'a (requires member Ceiling)

Full name: Api-overview.m
val m : 'a (requires member Round)

Full name: Api-overview.m
val m : 'a (requires member SoftPlus)

Full name: Api-overview.m
val m : 'a (requires member SoftSign)

Full name: Api-overview.m
val m : 'a (requires member Sigmoid)

Full name: Api-overview.m
val m : 'a (requires member ReLU)

Full name: Api-overview.m
val det : m:DM -> D

val inverse : m:DM -> DM

val transpose : m:DM -> DM

val trace : m:DM -> D

val diagonal : m:DM -> DV

val x : DV

Full name: Api-overview.x
val solve : m:DM -> v:DV -> DV

val solveSymmetric : m:DM -> v:DV -> DV

val toRows : m:DM -> seq<DV>

val ofRows : s:seq<DV> -> DM

val toCols : m:DM -> seq<DV>

val ofCols : s:seq<DV> -> DM

val array2D : rows:seq<#seq<'T>> -> 'T [,]

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.array2D
val appendRow : v:DV -> m:DM -> DM

val prependRow : v:DV -> m:DM -> DM

val appendCol : v:DV -> m:DM -> DM

val prependCol : v:DV -> m:DM -> DM

val a : float [,]

Full name: Api-overview.a
val rows : m:DM -> int

val cols : m:DM -> int

val length : m:DM -> int

val min : m:DM -> D

val max : m:DM -> D

val sum : m:DM -> D

val m : (DM -> DM)

Full name: Api-overview.m
val normalize : m:DM -> DM

val mapRows : f:(DV -> DV) -> m:DM -> DM

val mapCols : f:(DV -> DV) -> m:DM -> DM

val i : int
val j : int
val visualize : v:DV -> string

val printfn : format:Printf.TextWriterFormat<'T> -> 'T

Full name: Microsoft.FSharp.Core.ExtraTopLevelOperators.printfn
val visualize : m:DM -> string

namespace DiffSharp.Config
Multiple items
type GlobalConfig =
new : unit -> GlobalConfig
static member SetBackend : backend:string -> unit
static member SetEpsilon : e:float -> unit
static member SetEpsilon : e:float32 -> unit
static member SetVisualizationContrast : c:float -> unit
static member SetVisualizationContrast : c:float32 -> unit
static member SetVisualizationPalette : palette:string -> unit
static member Float32Backend : Backend<float32>
static member Float32Epsilon : float32
static member Float32EpsilonRec : float32
...

Full name: DiffSharp.Config.GlobalConfig

--------------------
new : unit -> DiffSharp.Config.GlobalConfig
static member DiffSharp.Config.GlobalConfig.SetVisualizationContrast : c:float -> unit
static member DiffSharp.Config.GlobalConfig.SetVisualizationContrast : c:float32 -> unit
static member DiffSharp.Config.GlobalConfig.SetVisualizationPalette : palette:string -> unit