Set of protocols for fastmath.
Includes:
Set of protocols for fastmath. Includes: * random generator protocol * distribution protocols * vector protocol
Get name and parameter names from distribution
Get name and parameter names from distribution
(distribution-id d)
Distribution id as keyword
Distribution id as keyword
(distribution-parameters d)
List of distribution parameter names
List of distribution parameter names
Get information from distributions.
Get information from distributions.
(lpdf d v)
Log density
Log density
(icdf d p)
Inverse cumulative probability
Inverse cumulative probability
(cdf d v)
(cdf d v1 v2)
Cumulative probability.
Cumulative probability.
(pdf d v)
Density
Density
(probability d v)
Probability (PMF)
Probability (PMF)
(continuous? d)
Does distribution support continuous range?
Does distribution support continuous range?
(source-object d)
Returns Java object from backend library
Returns Java object from backend library
(dimensions d)
Returns dimensions
Returns dimensions
(sample d)
Returns random sample.
Returns random sample.
(posterior-samples gp vs stddev?)
Draw samples from posterior for given vs
Draw samples from posterior for given vs
(prior-samples _ vs)
Draw samples from prior for given vs
Draw samples from prior for given vs
Common grid conversion functions.
Common grid conversion functions.
(cell->anchor g cell)
Converts cell coordinates to anchor coordinates.
Converts cell coordinates to anchor coordinates.
(coords->cell g coords)
Converts 2d space coordinates to cell coordinates.
Converts 2d space coordinates to cell coordinates.
(coords->mid g coords)
Converts 2d space into cell midpoint.
Converts 2d space into cell midpoint.
(corners g coords)
(corners g coords scale)
Returns list of cell vertices for given 2d space coordinates.
Returns list of cell vertices for given 2d space coordinates.
(grid-type g)
Returns type of the cell.
Returns type of the cell.
Get information from distributions.
Get information from distributions.
(covariance d)
Variance
Variance
(means d)
Mean
Mean
(backend _)
Return name of backend library
Return name of backend library
(cv _)
(cv _ params)
Cross-validation
Cross-validation
(data-native _)
Return data transformed for backend library.
Return data transformed for backend library.
(model-native _)
Return trained model as a backend class.
Return trained model as a backend class.
(predict _ v info?)
Predict for given vector. Additional info may be returned on request.
Predict for given vector. Additional info may be returned on request.
(predict-all _ v info?)
Predict for given sequence of vectors. Additional info may be returned on request.
Predict for given sequence of vectors. Additional info may be returned on request.
(train _)
(train _ x y)
Train another set of data for given model or force training already given data.
Train another set of data for given model or force training already given data.
Defines set of random functions for different RNGs or distributions returning primitive values.
Defines set of random functions for different RNGs or distributions returning primitive values.
(->seq rng)
(->seq rng n)
Returns lazy sequence of random samples (can be limited to optional n
values).
Returns lazy sequence of random samples (can be limited to optional `n` values).
(brandom rng)
(brandom rng p)
Boolean random.
Returns true or false with equal probability. You can set p
probability for true
Boolean random. Returns true or false with equal probability. You can set `p` probability for `true`
(drandom rng)
(drandom rng mx)
(drandom rng mn mx)
Random double.
As default returns random double from [0,1)
range.
When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
Random double. As default returns random double from `[0,1)` range. When `mx` is passed, range is set to `[0, mx)`. When `mn` is passed, range is set to `[mn, mx)`.
(frandom rng)
(frandom rng mx)
(frandom rng mn mx)
Random float.
As default returns random float from [0,1)
range.
When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
Random float. As default returns random float from `[0,1)` range. When `mx` is passed, range is set to `[0, mx)`. When `mn` is passed, range is set to `[mn, mx)`.
(grandom rng)
(grandom rng std)
(grandom rng mean std)
Random double from gaussian distribution.
As default returns random double from N(0,1)
.
When std
is passed, N(0,std)
is used. When mean
is passed, distribution is set to N(mean, std)
.
Random double from gaussian distribution. As default returns random double from `N(0,1)`. When `std` is passed, `N(0,std)` is used. When `mean` is passed, distribution is set to `N(mean, std)`.
(irandom rng)
(irandom rng mx)
(irandom rng mn mx)
Random integer.
As default returns random integer from full integer range.
When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
Random integer. As default returns random integer from full integer range. When `mx` is passed, range is set to `[0, mx)`. When `mn` is passed, range is set to `[mn, mx)`.
(lrandom rng)
(lrandom rng mx)
(lrandom rng mn mx)
Random long.
As default returns random long from full long range.
When mx
is passed, range is set to [0, mx)
. When mn
is passed, range is set to [mn, mx)
.
Random long. As default returns random long from full long range. When `mx` is passed, range is set to `[0, mx)`. When `mn` is passed, range is set to `[mn, mx)`.
(set-seed! rng v)
Sets seed. Returns rng
Sets seed. Returns `rng`
Transformer functions.
Transformer functions.
(forward-1d t xs)
Forward transform of sequence or array.
Forward transform of sequence or array.
(forward-2d t xss)
Forward transform of sequence of sequences.
Forward transform of sequence of sequences.
(reverse-1d t xs)
Reverse transform of sequence or array.
Reverse transform of sequence or array.
(reverse-2d t xss)
Reverse transform of sequence of sequences.
Reverse transform of sequence of sequences.
(lower-bound d)
Lower value
Lower value
(mean d)
Mean
Mean
(upper-bound d)
Higher value
Higher value
(variance d)
Variance
Variance
Vector operations
Vector operations
(to-vec v)
Convert to Clojure primitive vector Vec
.
Convert to Clojure primitive vector `Vec`.
(dot v1 v2)
Dot product of two vectors.
Dot product of two vectors.
(permute v idxs)
Permute vector elements with given indices.
Permute vector elements with given indices.
(add v1)
(add v1 v2)
Sum of two vectors.
Sum of two vectors.
(approx v)
(approx v d)
Round to 2 (or d
) decimal places
Round to 2 (or `d`) decimal places
(cross v1 v2)
Cross product
Cross product
(reciprocal v)
Reciprocal of elements.
Reciprocal of elements.
(sum v1)
Sum of elements
Sum of elements
(emn v1 v2)
Element-wise min from two vectors.
Element-wise min from two vectors.
(is-near-zero? v1)
(is-near-zero? v1 tol)
Is vector almost zero? (all absolute values of elements are less than tol
tolerance or 1.0e-6
)
Is vector almost zero? (all absolute values of elements are less than `tol` tolerance or `1.0e-6`)
(heading v1)
Angle between vector and unit vector [1,0,...]
Angle between vector and unit vector `[1,0,...]`
(axis-rotate v1 angle axis)
(axis-rotate v1 angle axis pivot)
Rotate around axis, 3d only
Rotate around axis, 3d only
(magsq v1)
Length of the vector squared.
Length of the vector squared.
(to-polar v1)
To polar coordinates (2d, 3d only), first element is length, the rest angle.
To polar coordinates (2d, 3d only), first element is length, the rest angle.
(transform v1 o vx vy)
(transform v1 o vx vy vz)
Transform vector; map point to coordinate system defined by origin, vx and vy (as bases), d and 3d only.
Transform vector; map point to coordinate system defined by origin, vx and vy (as bases), d and 3d only.
(mag v1)
length of the vector.
length of the vector.
(from-polar v1)
From polar coordinates (2d, 3d only)
From polar coordinates (2d, 3d only)
(sub v1)
(sub v1 v2)
Subtraction of two vectors.
Subtraction of two vectors.
(mindim v)
Index of minimum value.
Index of minimum value.
(is-zero? v1)
Is vector zero?
Is vector zero?
(econstrain v val1 val2)
Element-wise constrain
Element-wise constrain
(base-from v)
List of perpendicular vectors (basis)
List of perpendicular vectors (basis)
(emult v1 v2)
Element-wise vector multiplication (Hadamard product).
Element-wise vector multiplication (Hadamard product).
(maxdim v)
Index of maximum value.
Index of maximum value.
(emx v1 v2)
Element-wise max from two vectors.
Element-wise max from two vectors.
(interpolate v1 v2 t f)
Interpolate vectors, optionally set interpolation fn
Interpolate vectors, optionally set interpolation fn
(perpendicular v1)
(perpendicular v1 v2)
Perpendicular vector (only 2d).
Perpendicular vector (only 2d).
(as-vec v)
(as-vec v xs)
Create vector from sequence as given type.
Create vector from sequence as given type.
(mn v1)
Minimum value of vector elements
Minimum value of vector elements
(abs v1)
Absolute value of vector elements
Absolute value of vector elements
(einterpolate v1 v2 v f)
Interpolate vectors element-wise, optionally set interpolation fn
Interpolate vectors element-wise, optionally set interpolation fn
(mx v1)
Maximum value of vector elements
Maximum value of vector elements
(fmap v f)
Apply function to all vector values (like map but returns the same type).
Apply function to all vector values (like map but returns the same type).
(mult v1 v)
Multiply vector by number v
.
Multiply vector by number `v`.
(rotate v1 angle)
(rotate v1 anglex angley anglez)
Rotate vector
Rotate vector
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close