# brainpy.math module#

## Basis for Object-oriented Transformations#

 BrainPyObject([name]) The BrainPyObject class for whole BrainPy ecosystem. FunAsObject(target[, child_objs, dyn_vars, name]) Transform a Python function as a BrainPyObject. NodeList(value) A list to represent a dynamically changed numerical sequence in which its element can be changed during JIT compilation. NodeDict(*args, **kwargs) An object to represent a dict of node in which its element can be changed during JIT compilation. ListVar(value) A sequence variable, whose contents can be changed during JIT compilation. DictVar(*args, **kwargs) A dict variable, in which its element can be changed during JIT compilation. Variable(value_or_size[, dtype, batch_axis]) The pointer to specify the dynamical variable. Parameter(value_or_size[, dtype, batch_axis]) The pointer to specify the parameter. TrainVar(value_or_size[, dtype, batch_axis]) The pointer to specify the trainable variable. Partial(fun, *args[, child_objs, dyn_vars])

## Object-oriented Transformations#

 grad([func, grad_vars, dyn_vars, ...]) Automatic gradient computation for functions or class objects. vector_grad(func[, grad_vars, dyn_vars, ...]) Take vector-valued gradients for function func. jacobian(func[, grad_vars, dyn_vars, ...]) Extending automatic Jacobian (reverse-mode) of func to classes. jacrev(func[, grad_vars, dyn_vars, ...]) Extending automatic Jacobian (reverse-mode) of func to classes. jacfwd(func[, grad_vars, dyn_vars, ...]) Extending automatic Jacobian (forward-mode) of func to classes. hessian(func[, grad_vars, dyn_vars, ...]) Hessian of func as a dense array. make_loop(body_fun, dyn_vars[, out_vars, ...]) Make a for-loop function, which iterate over inputs. make_while(cond_fun, body_fun, dyn_vars) Make a while-loop function. make_cond(true_fun, false_fun[, dyn_vars]) Make a condition (if-else) function. cond(pred, true_fun, false_fun, operands[, ...]) Simple conditional statement (if-else) with instance of Variable. ifelse(conditions, branches[, operands, ...]) If-else control flows looks like native Pythonic programming. for_loop(body_fun, operands[, dyn_vars, ...]) for-loop control flow with Variable. while_loop(body_fun, cond_fun, operands[, ...]) while-loop control flow with Variable. to_object([f, child_objs, dyn_vars, name]) Transform a Python function to BrainPyObject. function([f, nodes, dyn_vars, name]) Transform a Python function into a BrainPyObject. jit([func, dyn_vars, child_objs, ...]) JIT (Just-In-Time) compilation for class objects. ObjectTransform([name]) Object-oriented JAX transformation for BrainPy computation.

## Brain Dynamics Dedicated Operators#

 pre2post_sum(pre_values, post_num, post_ids) The pre-to-post synaptic summation. pre2post_prod(pre_values, post_num, post_ids) The pre-to-post synaptic production. pre2post_max(pre_values, post_num, post_ids) The pre-to-post synaptic maximization. pre2post_min(pre_values, post_num, post_ids) The pre-to-post synaptic minimization. pre2post_mean(pre_values, post_num, post_ids) The pre-to-post synaptic mean computation. pre2post_event_sum(events, pre2post, post_num) The pre-to-post event-driven synaptic summation with CSR synapse structure. pre2post_coo_event_sum(events, pre_ids, ...) The pre-to-post synaptic computation with event-driven summation. pre2post_event_prod(events, pre2post, post_num) The pre-to-post synaptic computation with event-driven production. pre2syn(pre_values, pre_ids) The pre-to-syn computation. syn2post_sum(syn_values, post_ids, post_num) The syn-to-post summation computation. syn2post(syn_values, post_ids, post_num[, ...]) The syn-to-post summation computation. syn2post_prod(syn_values, post_ids, post_num) The syn-to-post product computation. syn2post_max(syn_values, post_ids, post_num) The syn-to-post maximum computation. syn2post_min(syn_values, post_ids, post_num) The syn-to-post minimization computation. syn2post_mean(syn_values, post_ids, post_num) The syn-to-post mean computation. syn2post_softmax(syn_values, post_ids, post_num) The syn-to-post softmax computation. sparse_matmul(A, B) Sparse matrix multiplication. csr_matvec(values, indices, indptr, vector, ...) Product of CSR sparse matrix and a dense vector. event_csr_matvec(values, indices, indptr, ...) The pre-to-post event-driven synaptic summation with CSR synapse structure. XLACustomOp([eval_shape, con_compute, ...]) Creating a XLA custom call operator.

## Activation Functions#

 celu(x[, alpha]) Continuously-differentiable exponential linear unit activation. elu(x[, alpha]) Exponential linear unit activation function. gelu(x[, approximate]) Gaussian error linear unit activation function. glu(x[, axis]) Gated linear unit activation function. Hard $$\mathrm{tanh}$$ activation function. Hard Sigmoid activation function. Hard SiLU activation function Hard SiLU activation function leaky_relu(x[, negative_slope]) Leaky rectified linear unit activation function. Log-sigmoid activation function. log_softmax(x[, axis]) Log-Softmax function. one_hot(x, num_classes, *[, dtype, axis]) One-hot encodes the given indicies. normalize(x[, axis, mean, variance, epsilon]) Normalizes an array by subtracting mean and dividing by sqrt(var). Rectified Linear Unit 6 activation function. Sigmoid activation function. Soft-sign activation function. softmax(x[, axis]) Softmax function. Softplus activation function. SiLU activation function. SiLU activation function. Scaled exponential linear unit activation. tanh Similar to jax.numpy.tanh function, while it is compatible with brainpy Array/Variable.

## Delay Variables#

 TimeDelay(delay_target, delay_len[, ...]) Delay variable which has a fixed delay time length. LengthDelay(delay_target, delay_len[, ...]) Delay variable which has a fixed delay length. NeuTimeDelay(delay_target, delay_len[, ...]) Neutral Time Delay. NeuLenDelay(delay_target, delay_len[, ...]) Neutral Length Delay. ROTATE_UPDATE str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str CONCAT_UPDATE str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

## Environment Settings#

 set_float(dtype) Set global default float type. Get the default float data type. set_int(dtype) Set global default integer type. Get the default int data type. set_bool(dtype) Set global default boolean type. Get the default boolean data type. set_complex(dtype) Set global default complex type. Get the default complex data type. set_dt(dt) Set the default numerical integrator precision. Get the numerical integrator precision. set_mode(mode) Set the default computing mode. Get the default computing mode. set([mode, dt, x64, complex_, float_, int_, ...]) Set the default computation environment. set_environment([mode, dt, x64, complex_, ...]) Set the default computation environment. set_platform(platform) Changes platform to CPU, GPU, or TPU. Get the computing platform. By default, XLA considers all CPU cores as one device. clear_buffer_memory([platform]) Clear all on-device buffers. Disable pre-allocating the GPU memory. Disable pre-allocating the GPU memory. Default int type. Default float type. environment([mode, dt, x64, complex_, ...]) Context-manager that sets a computing environment for brain dynamics computation. batching_environment([dt, x64, complex_, ...]) Environment with the batching mode. training_environment([dt, x64, complex_, ...]) Environment with the training mode.

## Computing Modes#

 Base class for computation Mode Normal non-batching mode. Batching mode. Training mode requires data batching. nonbatching_mode Normal non-batching mode. batching_mode Batching mode. training_mode Training mode requires data batching.

## Array Interoperability#

 as_device_array(tensor[, dtype]) Convert the input to a jax.numpy.DeviceArray. as_jax(tensor[, dtype]) Convert the input to a jax.numpy.DeviceArray. as_ndarray(tensor[, dtype]) Convert the input to a numpy.ndarray. as_numpy(tensor[, dtype]) Convert the input to a numpy.ndarray. as_variable(tensor[, dtype]) Convert the input to a brainpy.math.Variable.

## Array Operators with NumPy Syntax#

 fill_diagonal(a, val[, inplace]) empty(shape[, dtype]) empty_like(a[, dtype, shape]) ones(shape[, dtype]) ones_like(a[, dtype, shape]) zeros(shape[, dtype]) zeros_like(a[, dtype, shape]) array(a[, dtype, copy, order, ndmin]) rtype: Array asarray(a[, dtype, order]) arange(*args, **kwargs) linspace(*args, **kwargs) logspace(*args, **kwargs) full(shape, fill_value[, dtype, order, like]) Similar to jax.numpy.full function, while it is compatible with brainpy Array/Variable. full_like(a, fill_value[, dtype, order, ...]) Similar to jax.numpy.full_like function, while it is compatible with brainpy Array/Variable. eye(N[, M, k, dtype, order, like]) Similar to jax.numpy.eye function, while it is compatible with brainpy Array/Variable. diag(v[, k]) Similar to jax.numpy.diag function, while it is compatible with brainpy Array/Variable. tri(N[, M, k, dtype, like]) Similar to jax.numpy.tri function, while it is compatible with brainpy Array/Variable. tril(m[, k]) Similar to jax.numpy.tril function, while it is compatible with brainpy Array/Variable. triu(m[, k]) Similar to jax.numpy.triu function, while it is compatible with brainpy Array/Variable. real(val) Similar to jax.numpy.real function, while it is compatible with brainpy Array/Variable. imag(val) Similar to jax.numpy.imag function, while it is compatible with brainpy Array/Variable. conj Similar to jax.numpy.conjugate function, while it is compatible with brainpy Array/Variable. conjugate Similar to jax.numpy.conjugate function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.ndim function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.isreal function, while it is compatible with brainpy Array/Variable. isscalar(element) Similar to jax.numpy.isscalar function, while it is compatible with brainpy Array/Variable. add(input, other, *[, alpha, out]) rtype: Optional[Array] reciprocal Similar to jax.numpy.reciprocal function, while it is compatible with brainpy Array/Variable. negative Similar to jax.numpy.negative function, while it is compatible with brainpy Array/Variable. positive Similar to jax.numpy.positive function, while it is compatible with brainpy Array/Variable. multiply Similar to jax.numpy.multiply function, while it is compatible with brainpy Array/Variable. divide Similar to jax.numpy.true_divide function, while it is compatible with brainpy Array/Variable. power Similar to jax.numpy.power function, while it is compatible with brainpy Array/Variable. subtract Similar to jax.numpy.subtract function, while it is compatible with brainpy Array/Variable. true_divide Similar to jax.numpy.true_divide function, while it is compatible with brainpy Array/Variable. floor_divide Similar to jax.numpy.floor_divide function, while it is compatible with brainpy Array/Variable. float_power Similar to jax.numpy.float_power function, while it is compatible with brainpy Array/Variable. fmod Similar to jax.numpy.fmod function, while it is compatible with brainpy Array/Variable. mod Similar to jax.numpy.remainder function, while it is compatible with brainpy Array/Variable. modf Similar to jax.numpy.modf function, while it is compatible with brainpy Array/Variable. divmod Similar to jax.numpy.divmod function, while it is compatible with brainpy Array/Variable. remainder Similar to jax.numpy.remainder function, while it is compatible with brainpy Array/Variable. abs(input, *[, out]) rtype: Optional[Array] exp Similar to jax.numpy.exp function, while it is compatible with brainpy Array/Variable. exp2 Similar to jax.numpy.exp2 function, while it is compatible with brainpy Array/Variable. expm1 Similar to jax.numpy.expm1 function, while it is compatible with brainpy Array/Variable. log Similar to jax.numpy.log function, while it is compatible with brainpy Array/Variable. log10 Similar to jax.numpy.log10 function, while it is compatible with brainpy Array/Variable. log1p Similar to jax.numpy.log1p function, while it is compatible with brainpy Array/Variable. log2 Similar to jax.numpy.log2 function, while it is compatible with brainpy Array/Variable. logaddexp Similar to jax.numpy.logaddexp function, while it is compatible with brainpy Array/Variable. logaddexp2 Similar to jax.numpy.logaddexp2 function, while it is compatible with brainpy Array/Variable. lcm Similar to jax.numpy.lcm function, while it is compatible with brainpy Array/Variable. gcd Similar to jax.numpy.gcd function, while it is compatible with brainpy Array/Variable. arccos(input, *[, out]) rtype: Optional[Array] arccosh(input, *[, out]) rtype: Optional[Array] arcsin(input, *[, out]) rtype: Optional[Array] arcsinh Similar to jax.numpy.arcsinh function, while it is compatible with brainpy Array/Variable. arctan(input, *[, out]) rtype: Optional[Array] arctan2 Similar to jax.numpy.arctan2 function, while it is compatible with brainpy Array/Variable. arctanh Similar to jax.numpy.arctanh function, while it is compatible with brainpy Array/Variable. cos Similar to jax.numpy.cos function, while it is compatible with brainpy Array/Variable. cosh Similar to jax.numpy.cosh function, while it is compatible with brainpy Array/Variable. sin Similar to jax.numpy.sin function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.sinc function, while it is compatible with brainpy Array/Variable. sinh Similar to jax.numpy.sinh function, while it is compatible with brainpy Array/Variable. tan Similar to jax.numpy.tan function, while it is compatible with brainpy Array/Variable. tanh Similar to jax.numpy.tanh function, while it is compatible with brainpy Array/Variable. deg2rad Similar to jax.numpy.deg2rad function, while it is compatible with brainpy Array/Variable. hypot Similar to jax.numpy.hypot function, while it is compatible with brainpy Array/Variable. rad2deg Similar to jax.numpy.rad2deg function, while it is compatible with brainpy Array/Variable. degrees Similar to jax.numpy.rad2deg function, while it is compatible with brainpy Array/Variable. radians Similar to jax.numpy.deg2rad function, while it is compatible with brainpy Array/Variable. round(a[, decimals, out]) Similar to jax.numpy.around function, while it is compatible with brainpy Array/Variable. around(a[, decimals, out]) Similar to jax.numpy.around function, while it is compatible with brainpy Array/Variable. round_(a[, decimals, out]) Similar to jax.numpy.around function, while it is compatible with brainpy Array/Variable. rint Similar to jax.numpy.rint function, while it is compatible with brainpy Array/Variable. floor Similar to jax.numpy.floor function, while it is compatible with brainpy Array/Variable. ceil Similar to jax.numpy.ceil function, while it is compatible with brainpy Array/Variable. trunc Similar to jax.numpy.trunc function, while it is compatible with brainpy Array/Variable. fix(x[, out]) Similar to jax.numpy.fix function, while it is compatible with brainpy Array/Variable. prod(a[, axis, dtype, out, keepdims, ...]) Similar to jax.numpy.prod function, while it is compatible with brainpy Array/Variable. sum(a[, axis, dtype, out, keepdims, ...]) Similar to jax.numpy.sum function, while it is compatible with brainpy Array/Variable. diff(a[, n, axis, prepend, append]) Similar to jax.numpy.diff function, while it is compatible with brainpy Array/Variable. median(a[, axis, out, overwrite_input, keepdims]) Similar to jax.numpy.median function, while it is compatible with brainpy Array/Variable. nancumprod(a[, axis, dtype, out]) Similar to jax.numpy.nancumprod function, while it is compatible with brainpy Array/Variable. nancumsum(a[, axis, dtype, out]) Similar to jax.numpy.nancumsum function, while it is compatible with brainpy Array/Variable. nanprod(a[, axis, dtype, out, keepdims]) Similar to jax.numpy.nanprod function, while it is compatible with brainpy Array/Variable. nansum(a[, axis, dtype, out, keepdims]) Similar to jax.numpy.nansum function, while it is compatible with brainpy Array/Variable. cumprod(a[, axis, dtype, out]) Similar to jax.numpy.cumprod function, while it is compatible with brainpy Array/Variable. cumsum(a[, axis, dtype, out]) Similar to jax.numpy.cumsum function, while it is compatible with brainpy Array/Variable. ediff1d(ary[, to_end, to_begin]) Similar to jax.numpy.ediff1d function, while it is compatible with brainpy Array/Variable. cross(a, b[, axisa, axisb, axisc, axis]) Similar to jax.numpy.cross function, while it is compatible with brainpy Array/Variable. trapz(y[, x, dx, axis]) Similar to jax.numpy.trapz function, while it is compatible with brainpy Array/Variable. isfinite Similar to jax.numpy.isfinite function, while it is compatible with brainpy Array/Variable. isinf Similar to jax.numpy.isinf function, while it is compatible with brainpy Array/Variable. isnan Similar to jax.numpy.isnan function, while it is compatible with brainpy Array/Variable. signbit Similar to jax.numpy.signbit function, while it is compatible with brainpy Array/Variable. copysign Similar to jax.numpy.copysign function, while it is compatible with brainpy Array/Variable. nextafter Similar to jax.numpy.nextafter function, while it is compatible with brainpy Array/Variable. ldexp Similar to jax.numpy.ldexp function, while it is compatible with brainpy Array/Variable. frexp Similar to jax.numpy.frexp function, while it is compatible with brainpy Array/Variable. convolve(a, v[, mode]) Similar to jax.numpy.convolve function, while it is compatible with brainpy Array/Variable. sqrt Similar to jax.numpy.sqrt function, while it is compatible with brainpy Array/Variable. cbrt Similar to jax.numpy.cbrt function, while it is compatible with brainpy Array/Variable. square Similar to jax.numpy.square function, while it is compatible with brainpy Array/Variable. absolute(input, *[, out]) rtype: Optional[Array] fabs Similar to jax.numpy.fabs function, while it is compatible with brainpy Array/Variable. sign Similar to jax.numpy.sign function, while it is compatible with brainpy Array/Variable. heaviside Similar to jax.numpy.heaviside function, while it is compatible with brainpy Array/Variable. maximum Similar to jax.numpy.maximum function, while it is compatible with brainpy Array/Variable. minimum Similar to jax.numpy.minimum function, while it is compatible with brainpy Array/Variable. fmax Similar to jax.numpy.fmax function, while it is compatible with brainpy Array/Variable. fmin Similar to jax.numpy.fmin function, while it is compatible with brainpy Array/Variable. interp(x, xp, fp[, left, right, period]) Similar to jax.numpy.interp function, while it is compatible with brainpy Array/Variable. clip(a, a_min, a_max[, out]) Similar to jax.numpy.clip function, while it is compatible with brainpy Array/Variable. angle(input, *[, out]) rtype: Optional[Array] bitwise_and Similar to jax.numpy.bitwise_and function, while it is compatible with brainpy Array/Variable. bitwise_not Similar to jax.numpy.invert function, while it is compatible with brainpy Array/Variable. bitwise_or Similar to jax.numpy.bitwise_or function, while it is compatible with brainpy Array/Variable. bitwise_xor Similar to jax.numpy.bitwise_xor function, while it is compatible with brainpy Array/Variable. invert Similar to jax.numpy.invert function, while it is compatible with brainpy Array/Variable. left_shift Similar to jax.numpy.left_shift function, while it is compatible with brainpy Array/Variable. right_shift Similar to jax.numpy.right_shift function, while it is compatible with brainpy Array/Variable. equal Similar to jax.numpy.equal function, while it is compatible with brainpy Array/Variable. not_equal Similar to jax.numpy.not_equal function, while it is compatible with brainpy Array/Variable. greater Similar to jax.numpy.greater function, while it is compatible with brainpy Array/Variable. greater_equal Similar to jax.numpy.greater_equal function, while it is compatible with brainpy Array/Variable. less Similar to jax.numpy.less function, while it is compatible with brainpy Array/Variable. less_equal Similar to jax.numpy.less_equal function, while it is compatible with brainpy Array/Variable. array_equal(a1, a2[, equal_nan]) Similar to jax.numpy.array_equal function, while it is compatible with brainpy Array/Variable. isclose(a, b[, rtol, atol, equal_nan]) Similar to jax.numpy.isclose function, while it is compatible with brainpy Array/Variable. allclose(a, b[, rtol, atol, equal_nan]) Similar to jax.numpy.allclose function, while it is compatible with brainpy Array/Variable. logical_and Similar to jax.numpy.logical_and function, while it is compatible with brainpy Array/Variable. logical_not Similar to jax.numpy.logical_not function, while it is compatible with brainpy Array/Variable. logical_or Similar to jax.numpy.logical_or function, while it is compatible with brainpy Array/Variable. logical_xor Similar to jax.numpy.logical_xor function, while it is compatible with brainpy Array/Variable. all(a[, axis, out, keepdims, where]) Similar to jax.numpy.all function, while it is compatible with brainpy Array/Variable. any(a[, axis, out, keepdims, where]) Similar to jax.numpy.any function, while it is compatible with brainpy Array/Variable. alltrue(a[, axis, out, keepdims, where]) Similar to jax.numpy.all function, while it is compatible with brainpy Array/Variable. sometrue(a[, axis, out, keepdims, where]) Similar to jax.numpy.any function, while it is compatible with brainpy Array/Variable. Return the shape of an array. size(a[, axis]) Return the number of elements along a given axis. reshape(a, newshape[, order]) Similar to jax.numpy.reshape function, while it is compatible with brainpy Array/Variable. ravel(a[, order]) Similar to jax.numpy.ravel function, while it is compatible with brainpy Array/Variable. moveaxis(a, source, destination) Similar to jax.numpy.moveaxis function, while it is compatible with brainpy Array/Variable. transpose(a[, axes]) Similar to jax.numpy.transpose function, while it is compatible with brainpy Array/Variable. swapaxes(a, axis1, axis2) Similar to jax.numpy.swapaxes function, while it is compatible with brainpy Array/Variable. concatenate Similar to jax.numpy.concatenate function, while it is compatible with brainpy Array/Variable. stack(arrays[, axis, out]) Similar to jax.numpy.stack function, while it is compatible with brainpy Array/Variable. vstack(tup) Similar to jax.numpy.vstack function, while it is compatible with brainpy Array/Variable. hstack(tup) Similar to jax.numpy.hstack function, while it is compatible with brainpy Array/Variable. dstack(tup) Similar to jax.numpy.dstack function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.column_stack function, while it is compatible with brainpy Array/Variable. split(ary, indices_or_sections[, axis]) Similar to jax.numpy.split function, while it is compatible with brainpy Array/Variable. dsplit(ary, indices_or_sections) Similar to jax.numpy.dsplit function, while it is compatible with brainpy Array/Variable. hsplit(ary, indices_or_sections) Similar to jax.numpy.hsplit function, while it is compatible with brainpy Array/Variable. vsplit(ary, indices_or_sections) Similar to jax.numpy.vsplit function, while it is compatible with brainpy Array/Variable. tile(A, reps) Similar to jax.numpy.tile function, while it is compatible with brainpy Array/Variable. repeat(a, repeats[, axis]) Similar to jax.numpy.repeat function, while it is compatible with brainpy Array/Variable. unique(ar[, return_index, return_inverse, ...]) Similar to jax.numpy.unique function, while it is compatible with brainpy Array/Variable. append(arr, values[, axis]) Similar to jax.numpy.append function, while it is compatible with brainpy Array/Variable. flip(m[, axis]) Similar to jax.numpy.flip function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.fliplr function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.flipud function, while it is compatible with brainpy Array/Variable. roll(a, shift[, axis]) Similar to jax.numpy.roll function, while it is compatible with brainpy Array/Variable. atleast_1d(*arys) Similar to jax.numpy.atleast_1d function, while it is compatible with brainpy Array/Variable. atleast_2d(*arys) Similar to jax.numpy.atleast_2d function, while it is compatible with brainpy Array/Variable. atleast_3d(*arys) Similar to jax.numpy.atleast_3d function, while it is compatible with brainpy Array/Variable. expand_dims(a, axis) Similar to jax.numpy.expand_dims function, while it is compatible with brainpy Array/Variable. squeeze(a[, axis]) Similar to jax.numpy.squeeze function, while it is compatible with brainpy Array/Variable. sort(a[, axis, kind, order]) Similar to jax.numpy.sort function, while it is compatible with brainpy Array/Variable. argsort(a[, axis, kind, order]) Similar to jax.numpy.argsort function, while it is compatible with brainpy Array/Variable. argmax(a[, axis, out]) Similar to jax.numpy.argmax function, while it is compatible with brainpy Array/Variable. argmin(a[, axis, out]) Similar to jax.numpy.argmin function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.argwhere function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.nonzero function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.flatnonzero function, while it is compatible with brainpy Array/Variable. where Similar to jax.numpy.where function, while it is compatible with brainpy Array/Variable. searchsorted(a, v[, side, sorter]) Similar to jax.numpy.searchsorted function, while it is compatible with brainpy Array/Variable. extract(condition, arr) Similar to jax.numpy.extract function, while it is compatible with brainpy Array/Variable. count_nonzero(a[, axis, keepdims]) Similar to jax.numpy.count_nonzero function, while it is compatible with brainpy Array/Variable. max(a[, axis, out, keepdims, initial, where]) Similar to jax.numpy.amax function, while it is compatible with brainpy Array/Variable. min(a[, axis, out, keepdims, initial, where]) Similar to jax.numpy.amin function, while it is compatible with brainpy Array/Variable. amax(a[, axis, out, keepdims, initial, where]) Similar to jax.numpy.amax function, while it is compatible with brainpy Array/Variable. amin(a[, axis, out, keepdims, initial, where]) Similar to jax.numpy.amin function, while it is compatible with brainpy Array/Variable. array_split(ary, indices_or_sections[, axis]) Similar to jax.numpy.array_split function, while it is compatible with brainpy Array/Variable. meshgrid(*xi[, copy, sparse, indexing]) Similar to jax.numpy.meshgrid function, while it is compatible with brainpy Array/Variable. vander(x[, N, increasing]) Similar to jax.numpy.vander function, while it is compatible with brainpy Array/Variable. tril_indices(*args, **kwargs) Return the indices for the lower-triangle of an (n, m) array. tril_indices_from(arr[, k]) Similar to jax.numpy.tril_indices_from function, while it is compatible with brainpy Array/Variable. triu_indices(*args, **kwargs) Return the indices for the upper-triangle of an (n, m) array. triu_indices_from(arr[, k]) Similar to jax.numpy.triu_indices_from function, while it is compatible with brainpy Array/Variable. take(a, indices[, axis, out, mode]) Similar to jax.numpy.take function, while it is compatible with brainpy Array/Variable. select(condlist, choicelist[, default]) Similar to jax.numpy.select function, while it is compatible with brainpy Array/Variable. nanmin(a[, axis, out, keepdims]) Similar to jax.numpy.nanmin function, while it is compatible with brainpy Array/Variable. nanmax(a[, axis, out, keepdims]) Similar to jax.numpy.nanmax function, while it is compatible with brainpy Array/Variable. ptp(a[, axis, out, keepdims]) Similar to jax.numpy.ptp function, while it is compatible with brainpy Array/Variable. percentile(a, q[, axis, out, ...]) Similar to jax.numpy.percentile function, while it is compatible with brainpy Array/Variable. nanpercentile(a, q[, axis, out, ...]) Similar to jax.numpy.nanpercentile function, while it is compatible with brainpy Array/Variable. quantile(a, q[, axis, out, overwrite_input, ...]) Similar to jax.numpy.quantile function, while it is compatible with brainpy Array/Variable. nanquantile(a, q[, axis, out, ...]) Similar to jax.numpy.nanquantile function, while it is compatible with brainpy Array/Variable. average(a[, axis, weights, returned]) Similar to jax.numpy.average function, while it is compatible with brainpy Array/Variable. mean(a[, axis, dtype, out, keepdims, where]) Similar to jax.numpy.mean function, while it is compatible with brainpy Array/Variable. std(a[, axis, dtype, out, ddof, keepdims, where]) Similar to jax.numpy.std function, while it is compatible with brainpy Array/Variable. var(a[, axis, dtype, out, ddof, keepdims, where]) Similar to jax.numpy.var function, while it is compatible with brainpy Array/Variable. nanmedian(a[, axis, out, overwrite_input, ...]) Similar to jax.numpy.nanmedian function, while it is compatible with brainpy Array/Variable. nanmean(a[, axis, dtype, out, keepdims]) Similar to jax.numpy.nanmean function, while it is compatible with brainpy Array/Variable. nanstd(a[, axis, dtype, out, ddof, keepdims]) Similar to jax.numpy.nanstd function, while it is compatible with brainpy Array/Variable. nanvar(a[, axis, dtype, out, ddof, keepdims]) Similar to jax.numpy.nanvar function, while it is compatible with brainpy Array/Variable. corrcoef(x[, y, rowvar, bias, ddof, dtype]) Similar to jax.numpy.corrcoef function, while it is compatible with brainpy Array/Variable. correlate(a, v[, mode]) Similar to jax.numpy.correlate function, while it is compatible with brainpy Array/Variable. cov(m[, y, rowvar, bias, ddof, fweights, ...]) Similar to jax.numpy.cov function, while it is compatible with brainpy Array/Variable. histogram(a[, bins, range, normed, weights, ...]) Similar to jax.numpy.histogram function, while it is compatible with brainpy Array/Variable. bincount Similar to jax.numpy.bincount function, while it is compatible with brainpy Array/Variable. digitize(x, bins[, right]) Similar to jax.numpy.digitize function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.bartlett function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.blackman function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.hamming function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.hanning function, while it is compatible with brainpy Array/Variable. kaiser(M, beta) Similar to jax.numpy.kaiser function, while it is compatible with brainpy Array/Variable. dot Similar to jax.numpy.dot function, while it is compatible with brainpy Array/Variable. vdot Similar to jax.numpy.vdot function, while it is compatible with brainpy Array/Variable. inner Similar to jax.numpy.inner function, while it is compatible with brainpy Array/Variable. outer(a, b[, out]) Similar to jax.numpy.outer function, while it is compatible with brainpy Array/Variable. kron(a, b) Similar to jax.numpy.kron function, while it is compatible with brainpy Array/Variable. matmul Similar to jax.numpy.matmul function, while it is compatible with brainpy Array/Variable. trace(a[, offset, axis1, axis2, dtype, out]) Similar to jax.numpy.trace function, while it is compatible with brainpy Array/Variable. product(a[, axis, dtype, out, keepdims, ...]) Similar to jax.numpy.prod function, while it is compatible with brainpy Array/Variable. row_stack(tup) Similar to jax.numpy.vstack function, while it is compatible with brainpy Array/Variable. apply_over_axes(func, a, axes) Similar to jax.numpy.apply_over_axes function, while it is compatible with brainpy Array/Variable. apply_along_axis(func1d, axis, arr, *args, ...) Similar to jax.numpy.apply_along_axis function, while it is compatible with brainpy Array/Variable. array_equiv(a1, a2) Similar to jax.numpy.array_equiv function, while it is compatible with brainpy Array/Variable. array_repr(arr[, max_line_width, precision, ...]) Similar to jax.numpy.array_repr function, while it is compatible with brainpy Array/Variable. array_str(a[, max_line_width, precision, ...]) Similar to jax.numpy.array_str function, while it is compatible with brainpy Array/Variable. block(arrays) Similar to jax.numpy.block function, while it is compatible with brainpy Array/Variable. broadcast_arrays(*args[, subok]) Similar to jax.numpy.broadcast_arrays function, while it is compatible with brainpy Array/Variable. broadcast_shapes(*args) Similar to jax.numpy.broadcast_shapes function, while it is compatible with brainpy Array/Variable. broadcast_to(array, shape[, subok]) Similar to jax.numpy.broadcast_to function, while it is compatible with brainpy Array/Variable. compress(condition, a[, axis, out]) Similar to jax.numpy.compress function, while it is compatible with brainpy Array/Variable. cumproduct(a[, axis, dtype, out]) Similar to jax.numpy.cumprod function, while it is compatible with brainpy Array/Variable. diag_indices(n[, ndim]) Similar to jax.numpy.diag_indices function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.diag_indices_from function, while it is compatible with brainpy Array/Variable. diagflat(v[, k]) Similar to jax.numpy.diagflat function, while it is compatible with brainpy Array/Variable. diagonal(a[, offset, axis1, axis2]) Similar to jax.numpy.diagonal function, while it is compatible with brainpy Array/Variable. einsum(*operands[, out, optimize]) Similar to jax.numpy.einsum function, while it is compatible with brainpy Array/Variable. einsum_path(*operands[, optimize, einsum_call]) Similar to jax.numpy.einsum_path function, while it is compatible with brainpy Array/Variable. geomspace(start, stop[, num, endpoint, ...]) Similar to jax.numpy.geomspace function, while it is compatible with brainpy Array/Variable. gradient(f, *varargs[, axis, edge_order]) Similar to jax.numpy.gradient function, while it is compatible with brainpy Array/Variable. histogram2d(x, y[, bins, range, normed, ...]) Similar to jax.numpy.histogram2d function, while it is compatible with brainpy Array/Variable. histogram_bin_edges(a[, bins, range, weights]) Similar to jax.numpy.histogram_bin_edges function, while it is compatible with brainpy Array/Variable. histogramdd(sample[, bins, range, normed, ...]) Similar to jax.numpy.histogramdd function, while it is compatible with brainpy Array/Variable. i0(x) Similar to jax.numpy.i0 function, while it is compatible with brainpy Array/Variable. in1d(ar1, ar2[, assume_unique, invert]) Similar to jax.numpy.in1d function, while it is compatible with brainpy Array/Variable. indices(dimensions[, dtype, sparse]) Similar to jax.numpy.indices function, while it is compatible with brainpy Array/Variable. insert(arr, obj, values[, axis]) Similar to jax.numpy.insert function, while it is compatible with brainpy Array/Variable. intersect1d(ar1, ar2[, assume_unique, ...]) Similar to jax.numpy.intersect1d function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.iscomplex function, while it is compatible with brainpy Array/Variable. isin(element, test_elements[, ...]) Similar to jax.numpy.isin function, while it is compatible with brainpy Array/Variable. ix_(*args) Similar to jax.numpy.ix_ function, while it is compatible with brainpy Array/Variable. lexsort Similar to jax.numpy.lexsort function, while it is compatible with brainpy Array/Variable. load(file[, mmap_mode, allow_pickle, ...]) Similar to jax.numpy.load function, while it is compatible with brainpy Array/Variable. save(file, arr[, allow_pickle, fix_imports]) Similar to jax.numpy.save function, while it is compatible with brainpy Array/Variable. savez(file, *args, **kwds) Similar to jax.numpy.savez function, while it is compatible with brainpy Array/Variable. mask_indices(n, mask_func[, k]) Similar to jax.numpy.mask_indices function, while it is compatible with brainpy Array/Variable. Return a copy of an array sorted along the first axis. nan_to_num(x[, copy, nan, posinf, neginf]) Similar to jax.numpy.nan_to_num function, while it is compatible with brainpy Array/Variable. nanargmax(a[, axis]) Similar to jax.numpy.nanargmax function, while it is compatible with brainpy Array/Variable. setdiff1d(ar1, ar2[, assume_unique]) Similar to jax.numpy.setdiff1d function, while it is compatible with brainpy Array/Variable. nanargmin(a[, axis]) Similar to jax.numpy.nanargmin function, while it is compatible with brainpy Array/Variable. pad(array, pad_width[, mode]) Similar to jax.numpy.pad function, while it is compatible with brainpy Array/Variable. poly(seq_of_zeros) Similar to jax.numpy.poly function, while it is compatible with brainpy Array/Variable. polyadd(a1, a2) Similar to jax.numpy.polyadd function, while it is compatible with brainpy Array/Variable. polyder(p[, m]) Similar to jax.numpy.polyder function, while it is compatible with brainpy Array/Variable. polyfit(x, y, deg[, rcond, full, w, cov]) Similar to jax.numpy.polyfit function, while it is compatible with brainpy Array/Variable. polyint(p[, m, k]) Similar to jax.numpy.polyint function, while it is compatible with brainpy Array/Variable. polymul(a1, a2) Similar to jax.numpy.polymul function, while it is compatible with brainpy Array/Variable. polysub(a1, a2) Similar to jax.numpy.polysub function, while it is compatible with brainpy Array/Variable. polyval(p, x) Similar to jax.numpy.polyval function, while it is compatible with brainpy Array/Variable. resize(a, new_shape) Similar to jax.numpy.resize function, while it is compatible with brainpy Array/Variable. rollaxis(a, axis[, start]) Similar to jax.numpy.rollaxis function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.roots function, while it is compatible with brainpy Array/Variable. rot90(m[, k, axes]) Similar to jax.numpy.rot90 function, while it is compatible with brainpy Array/Variable. setxor1d(ar1, ar2[, assume_unique]) Similar to jax.numpy.setxor1d function, while it is compatible with brainpy Array/Variable. tensordot(a, b[, axes]) Similar to jax.numpy.tensordot function, while it is compatible with brainpy Array/Variable. trim_zeros(filt[, trim]) Similar to jax.numpy.trim_zeros function, while it is compatible with brainpy Array/Variable. union1d(ar1, ar2) Similar to jax.numpy.union1d function, while it is compatible with brainpy Array/Variable. unravel_index Similar to jax.numpy.unravel_index function, while it is compatible with brainpy Array/Variable. unwrap(p[, discont, axis, period]) Similar to jax.numpy.unwrap function, while it is compatible with brainpy Array/Variable. take_along_axis(arr, indices, axis) Similar to jax.numpy.take_along_axis function, while it is compatible with brainpy Array/Variable. can_cast Similar to jax.numpy.can_cast function, while it is compatible with brainpy Array/Variable. choose(a, choices[, out, mode]) Similar to jax.numpy.choose function, while it is compatible with brainpy Array/Variable. copy(a[, order, subok]) Similar to jax.numpy.copy function, while it is compatible with brainpy Array/Variable. frombuffer Similar to jax.numpy.frombuffer function, while it is compatible with brainpy Array/Variable. fromfile(*args, **kwargs) Similar to jax.numpy.fromfile function, while it is compatible with brainpy Array/Variable. fromfunction(function, shape, *[, dtype, like]) Similar to jax.numpy.fromfunction function, while it is compatible with brainpy Array/Variable. fromiter(*args, **kwargs) Similar to jax.numpy.fromiter function, while it is compatible with brainpy Array/Variable. fromstring Similar to jax.numpy.fromstring function, while it is compatible with brainpy Array/Variable. Return the current print options. Similar to jax.numpy.iscomplexobj function, while it is compatible with brainpy Array/Variable. isneginf(x[, out]) Similar to jax.numpy.isneginf function, while it is compatible with brainpy Array/Variable. isposinf(x[, out]) Similar to jax.numpy.isposinf function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.isrealobj function, while it is compatible with brainpy Array/Variable. issubdtype(arg1, arg2) Returns True if first argument is a typecode lower/equal in type hierarchy. issubsctype(arg1, arg2) Determine if the first argument is a subclass of the second argument. Similar to jax.numpy.iterable function, while it is compatible with brainpy Array/Variable. packbits Similar to jax.numpy.packbits function, while it is compatible with brainpy Array/Variable. piecewise(x, condlist, funclist, *args, **kw) Similar to jax.numpy.piecewise function, while it is compatible with brainpy Array/Variable. printoptions(*args, **kwargs) Context manager for setting print options. set_printoptions([precision, threshold, ...]) Set printing options. promote_types(a, b) Similar to jax.numpy.promote_types function, while it is compatible with brainpy Array/Variable. ravel_multi_index Similar to jax.numpy.ravel_multi_index function, while it is compatible with brainpy Array/Variable. result_type Similar to jax.numpy.result_type function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.sort_complex function, while it is compatible with brainpy Array/Variable. unpackbits Similar to jax.numpy.unpackbits function, while it is compatible with brainpy Array/Variable. delete(arr, obj[, axis]) Similar to jax.numpy.delete function, while it is compatible with brainpy Array/Variable. add_newdoc(place, obj, doc[, warn_on_python]) Add documentation to an existing object, typically one defined in C array2string(a[, max_line_width, precision, ...]) asanyarray(a[, dtype, order]) ascontiguousarray(a[, dtype, order]) asfarray(a[, dtype]) common_type(*arrays) disp(mesg[, device, linefeed]) Display a message on a device. genfromtxt(*args, **kwargs) loadtxt(*args, **kwargs) info([object, maxwidth, output, toplevel]) Get help information for a function, class, or module. issubclass_(arg1, arg2) Determine if a class is a subclass of a second class. place(arr, mask, vals) polydiv(u, v) Similar to jax.numpy.polydiv function, while it is compatible with brainpy Array/Variable. put(a, ind, v) putmask(a, mask, values) safe_eval(source) savetxt(fname, X[, fmt, delimiter, newline, ...]) savez_compressed(file, *args, **kwds) Show libraries in the system on which NumPy was built. typename(char) Return a description for the given data type code. copyto(dst, src) matrix(data[, dtype]) asmatrix(data[, dtype]) mat(data[, dtype]) dtype(dtype[, align, copy]) Create a data type object. finfo(dtype) Machine limits for floating point types. iinfo(type) Machine limits for integer types. e Convert a string or number to a floating point number, if possible. pi Convert a string or number to a floating point number, if possible. inf Convert a string or number to a floating point number, if possible. add_docstring(obj, docstring) Add a docstring to a built-in obj if possible. add_newdoc_ufunc add_ufunc_docstring(ufunc, new_docstring)

## Array Operators with PyTorch Syntax#

 flatten(input[, start_dim, end_dim]) Flattens input by reshaping it into a one-dimensional tensor. cat Similar to jax.numpy.concatenate function, while it is compatible with brainpy Array/Variable. unsqueeze(input, dim) Returns a new tensor with a dimension of size one inserted at the specified position. abs(input, *[, out]) rtype: Optional[Array] absolute(input, *[, out]) rtype: Optional[Array] acos(input, *[, out]) rtype: Optional[Array] arccos(input, *[, out]) rtype: Optional[Array] acosh(input, *[, out]) rtype: Optional[Array] arccosh(input, *[, out]) rtype: Optional[Array] add(input, other, *[, alpha, out]) rtype: Optional[Array] addcdiv(input, tensor1, tensor2, *[, value, out]) rtype: Optional[Array] addcmul(input, tensor1, tensor2, *[, value, out]) rtype: Optional[Array] angle(input, *[, out]) rtype: Optional[Array] asin(input, *[, out]) rtype: Optional[Array] arcsin(input, *[, out]) rtype: Optional[Array] asinh(input, *[, out]) rtype: Optional[Array] atan(input, *[, out]) rtype: Optional[Array] arctan(input, *[, out]) rtype: Optional[Array] atan2(input, *[, out]) rtype: Optional[Array] atanh(input, *[, out]) rtype: Optional[Array] Tensor alias of Array

## Array Operators with TensorFlow Syntax#

 concat Similar to jax.numpy.concatenate function, while it is compatible with brainpy Array/Variable. reduce_sum(a[, axis, dtype, out, keepdims, ...]) Similar to jax.numpy.sum function, while it is compatible with brainpy Array/Variable. reduce_max(input_tensor[, axis, keepdims]) Computes maximum of elements across dimensions of a tensor. reduce_min(a[, axis, out, keepdims, ...]) Similar to jax.numpy.amin function, while it is compatible with brainpy Array/Variable. reduce_mean(a[, axis, dtype, out, keepdims, ...]) Similar to jax.numpy.mean function, while it is compatible with brainpy Array/Variable. reduce_all(a[, axis, out, keepdims, where]) Similar to jax.numpy.all function, while it is compatible with brainpy Array/Variable. reduce_any(a[, axis, out, keepdims, where]) Similar to jax.numpy.any function, while it is compatible with brainpy Array/Variable. reduce_logsumexp(input_tensor[, axis, keepdims]) Computes log(sum(exp(elements across dimensions of a tensor))). reduce_prod(a[, axis, dtype, out, keepdims, ...]) Similar to jax.numpy.prod function, while it is compatible with brainpy Array/Variable. reduce_std(a[, axis, dtype, out, ddof, ...]) Similar to jax.numpy.std function, while it is compatible with brainpy Array/Variable. reduce_variance(a[, axis, dtype, out, ddof, ...]) Similar to jax.numpy.var function, while it is compatible with brainpy Array/Variable. reduce_euclidean_norm(input_tensor[, axis, ...]) Computes the Euclidean norm of elements across dimensions of a tensor. unsorted_segment_sqrt_n(data, segment_ids, ...) Computes the sum along segments of a tensor divided by the sqrt(N). segment_mean(data, segment_ids) Computes the average along segments of a tensor. unsorted_segment_sum(data, segment_ids, ...) Computes the sum along segments of a tensor. unsorted_segment_prod(data, segment_ids, ...) Computes the product along segments of a tensor. unsorted_segment_max(data, segment_ids, ...) Computes the maximum along segments of a tensor. unsorted_segment_min(data, segment_ids, ...) Computes the minimum along segments of a tensor. unsorted_segment_mean(data, segment_ids, ...) Computes the average along segments of a tensor. segment_sum(data, segment_ids[, ...]) segment_sum operator for brainpy Array and Variable. segment_prod(data, segment_ids[, ...]) segment_prod operator for brainpy Array and Variable. segment_max(data, segment_ids[, ...]) segment_max operator for brainpy Array and Variable. segment_min(data, segment_ids[, ...]) segment_min operator for brainpy Array and Variable. clip_by_value(a, a_min, a_max[, out]) Similar to jax.numpy.clip function, while it is compatible with brainpy Array/Variable. cast(x, dtype) Casts a tensor to a new type.

## brainpy.math.surrogate module: Surrogate Gradient Functions#

 Sigmoid([alpha, orgin]) PiecewiseQuadratic([alpha, origin]) PiecewiseExp([alpha, origin]) SoftSign([alpha, origin]) Arctan([alpha, origin]) NonzeroSignLog([alpha, origin]) ERF([alpha, origin]) PiecewiseLeakyRelu([c, w, origin]) SquarewaveFourierSeries([n, t_period, origin]) S2NN([alpha, beta, epsilon, origin]) QPseudoSpike([alpha, origin]) LeakyRelu([alpha, beta, origin]) LogTailedRelu([alpha, origin]) ReluGrad([alpha, width]) GaussianGrad([sigma, alpha]) InvSquareGrad([alpha]) MultiGaussianGrad([h, s, sigma, scale]) SlayerGrad([alpha]) sigmoid Spike function with the sigmoid-shaped surrogate gradient. piecewise_quadratic Judge spiking state with a piecewise quadratic function [1]_ [2]_ [3]_ [4]_ [5]_. piecewise_exp Judge spiking state with a piecewise exponential function [1]_. soft_sign Judge spiking state with a soft sign function. arctan Judge spiking state with an arctan function. nonzero_sign_log Judge spiking state with a nonzero sign log function. erf Judge spiking state with an erf function [1]_ [2]_ [3]_. piecewise_leaky_relu Judge spiking state with a piecewise leaky relu function [1]_ [2]_ [3]_ [4]_ [5]_ [6]_ [7]_ [8]_. squarewave_fourier_series Judge spiking state with a squarewave fourier series. s2nn Judge spiking state with the S2NN surrogate spiking function [1]_. q_pseudo_spike Judge spiking state with the q-PseudoSpike surrogate function [1]_. leaky_relu Judge spiking state with the Leaky ReLU function. log_tailed_relu Judge spiking state with the Log-tailed ReLU function [1]_. relu_grad Spike function with the ReLU gradient function [1]_. gaussian_grad Spike function with the Gaussian gradient function [1]_. inv_square_grad Spike function with the inverse-square surrogate gradient. multi_gaussian_grad Spike function with the multi-Gaussian gradient function [1]_. slayer_grad Spike function with the slayer surrogate gradient function. inv_square_grad2 relu_grad2

## brainpy.math.random module: Random Number Generations#

 seed([seed]) Sets a new random seed. default_rng([seed_or_key, clone]) rtype: RandomState rand(*dn[, key]) Random values in a given shape. randint(low[, high, size, dtype, key]) Return random integers from low (inclusive) to high (exclusive). random_integers(low[, high, size, key]) Random integers of type np.int_ between low and high, inclusive. randn(*dn[, key]) Return a sample (or samples) from the "standard normal" distribution. random([size, key]) Return random floats in the half-open interval [0.0, 1.0). random_sample([size, key]) Return random floats in the half-open interval [0.0, 1.0). ranf([size, key]) This is an alias of random_sample. See random_sample for the complete sample([size, key]) This is an alias of random_sample. See random_sample for the complete choice(a[, size, replace, p, key]) Generates a random sample from a given 1-D array permutation(x[, axis, independent, key]) Randomly permute a sequence, or return a permuted range. shuffle(x[, axis, key]) Modify a sequence in-place by shuffling its contents. beta(a, b[, size, key]) Draw samples from a Beta distribution. exponential([scale, size, key]) gamma(shape[, scale, size, key]) gumbel([loc, scale, size, key]) laplace([loc, scale, size, key]) logistic([loc, scale, size, key]) normal([loc, scale, size, key]) pareto(a[, size, key]) poisson([lam, size, key]) standard_cauchy([size, key]) standard_exponential([size, key]) standard_gamma(shape[, size, key]) standard_normal([size, key]) standard_t(df[, size, key]) uniform([low, high, size, key]) truncated_normal(lower, upper[, size, ...]) Sample truncated standard normal random values with given shape and dtype. bernoulli([p, size, key]) Sample Bernoulli random values with given shape and mean. lognormal([mean, sigma, size, key]) binomial(n, p[, size, key]) chisquare(df[, size, key]) dirichlet(alpha[, size, key]) geometric(p[, size, key]) f(dfnum, dfden[, size, key]) hypergeometric(ngood, nbad, nsample[, size, key]) logseries(p[, size, key]) multinomial(n, pvals[, size, key]) multivariate_normal(mean, cov[, size, ...]) negative_binomial(n, p[, size, key]) noncentral_chisquare(df, nonc[, size, key]) noncentral_f(dfnum, dfden, nonc[, size, key]) power(a[, size, key]) rayleigh([scale, size, key]) triangular([size, key]) vonmises(mu, kappa[, size, key]) wald(mean, scale[, size, key]) weibull(a[, size, key]) Draw samples from a Weibull distribution. weibull_min(a[, scale, size, key]) Sample from a Weibull distribution. zipf(a[, size, key]) Draw samples from a Zipf distribution. maxwell([size, key]) Sample from a one sided Maxwell distribution. t(df[, size, key]) Sample Student’s t random values. orthogonal(n[, size, key]) Sample uniformly from the orthogonal group O(n). loggamma(a[, size, key]) Sample log-gamma random values. categorical(logits[, axis, size, key]) Sample random values from categorical distributions. rand_like(input, *[, dtype, key]) Similar to rand_like in torch. randint_like(input[, low, high, dtype, key]) Similar to randint_like in torch. randn_like(input, *[, dtype, key]) Similar to randn_like in torch. RandomState([seed_or_key, seed]) RandomState that track the random generator state. Generator alias of RandomState DEFAULT RandomState that track the random generator state.

## brainpy.math.linalg module: Linear algebra#

 Similar to jax.numpy.linalg.cholesky function, while it is compatible with brainpy Array/Variable. cond(x[, p]) Similar to jax.numpy.linalg.cond function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.linalg.det function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.linalg.eig function, while it is compatible with brainpy Array/Variable. eigh(a[, UPLO]) Similar to jax.numpy.linalg.eigh function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.linalg.eigvals function, while it is compatible with brainpy Array/Variable. eigvalsh(a[, UPLO]) Similar to jax.numpy.linalg.eigvalsh function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.linalg.inv function, while it is compatible with brainpy Array/Variable. svd(a[, full_matrices, compute_uv, hermitian]) Similar to jax.numpy.linalg.svd function, while it is compatible with brainpy Array/Variable. lstsq(a, b[, rcond]) Similar to jax.numpy.linalg.lstsq function, while it is compatible with brainpy Array/Variable. matrix_power(a, n) Similar to jax.numpy.linalg.matrix_power function, while it is compatible with brainpy Array/Variable. matrix_rank(M[, tol, hermitian]) Similar to jax.numpy.linalg.matrix_rank function, while it is compatible with brainpy Array/Variable. norm(x[, ord, axis, keepdims]) Similar to jax.numpy.linalg.norm function, while it is compatible with brainpy Array/Variable. pinv(a[, rcond, hermitian]) Similar to jax.numpy.linalg.pinv function, while it is compatible with brainpy Array/Variable. qr(a[, mode]) Similar to jax.numpy.linalg.qr function, while it is compatible with brainpy Array/Variable. solve(a, b) Similar to jax.numpy.linalg.solve function, while it is compatible with brainpy Array/Variable. Similar to jax.numpy.linalg.slogdet function, while it is compatible with brainpy Array/Variable. tensorinv(a[, ind]) Similar to jax.numpy.linalg.tensorinv function, while it is compatible with brainpy Array/Variable. tensorsolve(a, b[, axes]) Similar to jax.numpy.linalg.tensorsolve function, while it is compatible with brainpy Array/Variable. multi_dot(arrays, *[, out]) Similar to jax.numpy.linalg.multi_dot function, while it is compatible with brainpy Array/Variable.

## brainpy.math.fft module: Discrete Fourier Transform#

 fft(a[, n, axis, norm]) Similar to jax.numpy.fft.fft function, while it is compatible with brainpy Array/Variable. fft2(a[, s, axes, norm]) Similar to jax.numpy.fft.fft2 function, while it is compatible with brainpy Array/Variable. fftfreq(n[, d]) Similar to jax.numpy.fft.fftfreq function, while it is compatible with brainpy Array/Variable. fftn(a[, s, axes, norm]) Similar to jax.numpy.fft.fftn function, while it is compatible with brainpy Array/Variable. fftshift(x[, axes]) Similar to jax.numpy.fft.fftshift function, while it is compatible with brainpy Array/Variable. hfft(a[, n, axis, norm]) Similar to jax.numpy.fft.hfft function, while it is compatible with brainpy Array/Variable. ifft(a[, n, axis, norm]) Similar to jax.numpy.fft.ifft function, while it is compatible with brainpy Array/Variable. ifft2(a[, s, axes, norm]) Similar to jax.numpy.fft.ifft2 function, while it is compatible with brainpy Array/Variable. ifftn(a[, s, axes, norm]) Similar to jax.numpy.fft.ifftn function, while it is compatible with brainpy Array/Variable. ifftshift(x[, axes]) Similar to jax.numpy.fft.ifftshift function, while it is compatible with brainpy Array/Variable. ihfft(a[, n, axis, norm]) Similar to jax.numpy.fft.ihfft function, while it is compatible with brainpy Array/Variable. irfft(a[, n, axis, norm]) Similar to jax.numpy.fft.irfft function, while it is compatible with brainpy Array/Variable. irfft2(a[, s, axes, norm]) Similar to jax.numpy.fft.irfft2 function, while it is compatible with brainpy Array/Variable. irfftn(a[, s, axes, norm]) Similar to jax.numpy.fft.irfftn function, while it is compatible with brainpy Array/Variable. rfft(a[, n, axis, norm]) Similar to jax.numpy.fft.rfft function, while it is compatible with brainpy Array/Variable. rfft2(a[, s, axes, norm]) Similar to jax.numpy.fft.rfft2 function, while it is compatible with brainpy Array/Variable. rfftfreq(n[, d]) Similar to jax.numpy.fft.rfftfreq function, while it is compatible with brainpy Array/Variable. rfftn(a[, s, axes, norm]) Similar to jax.numpy.fft.rfftn function, while it is compatible with brainpy Array/Variable.