Helper functions

Leading coefficient

lead_coefficient(poly[, graded, reverse])

Find the lead coefficients for each polynomial.

lead_exponent(poly[, graded, reverse])

Find the lead exponents for each polynomial.

sortable_proxy(poly[, graded, reverse])

Create a numerical proxy for a polynomial to allow compare.

Polynomial specific

call(poly[, args, kwargs])

Evaluate polynomial by inserting new values in to the indeterminants.

decompose(poly)

Decompose a polynomial to component form.

set_dimensions(poly[, dimensions])

Adjust the dimensions of a polynomial.

isconstant(poly)

Check if a polynomial is constant or not.

ndpoly.isconstant()

Check if a polynomial is constant or not.

ndpoly.todict()

Cast to dict where keys are exponents and values are coefficients.

ndpoly.tonumpy()

Cast polynomial to numpy.ndarray, if possible.

Array creation

diag(y[, k])

Extract a diagonal or construct a diagonal array.

diagonal(a[, offset, axis1, axis2])

Return specified diagonals.

full(shape, fill_value[, dtype, order])

Return a new array of given shape and type, filled with fill_value.

full_like(a, fill_value[, dtype, order, ...])

Return a full array with the same shape and type as a given array.

ones(shape[, dtype, order])

Return a new array of given shape and type, filled with ones.

ones_like(a[, dtype, order, subok, shape])

Return an array of ones with the same shape and type as a given array.

zeros(shape[, dtype, order])

Return a new array of given shape and type, filled with zeros.

zeros_like(a[, dtype, order, subok, shape])

Return an array of zeros with the same shape and type as a given array.

Arithmetics

add(x1, x2[, out, where])

Add arguments element-wise.

inner(a, b)

Inner product of two arrays.

matmul(x1, x2[, out])

Matrix product of two arrays.

multiply(x1, x2[, out, where])

Multiply arguments element-wise.

negative(x[, out, where])

Numerical negative, element-wise.

outer(a, b[, out])

Compute the outer product of two vectors.

positive(x[, out, where])

Numerical positive, element-wise.

power(x1, x2, **kwargs)

First array elements raised to powers from second array, element-wise.

subtract(x1, x2[, out, where])

Subtract arguments, element-wise.

square(x[, out, where])

Return the element-wise square of the input.

Division

divide(x1, x2[, out, where])

Return true division of the inputs, element-wise.

divmod(x1, x2[, out, where])

Return element-wise quotient and remainder simultaneously.

floor_divide(x1, x2[, out, where])

Return the largest integer smaller or equal to the division of the inputs.

mod(x1, x2[, out, where])

Return element-wise remainder of numerical division.

poly_divide(x1, x2[, out, where])

Return a polynomial division of the inputs, element-wise.

poly_divmod(dividend, divisor[, out, where])

Return element-wise quotient and remainder simultaneously.

poly_remainder(x1, x2[, out, where])

Return element-wise remainder of polynomial division.

remainder(x1, x2[, out, where])

Return element-wise remainder of numerical division.

true_divide(x1, x2[, out, where])

Return true division of the inputs, element-wise.

Logic

any(a[, axis, out, keepdims])

Test whether any array element along a given axis evaluates to True.

all(a[, axis, out, keepdims])

Test whether all array elements along a given axis evaluate to True.

allclose(a, b[, rtol, atol, equal_nan])

Return True if two arrays are element-wise equal within a tolerance.

equal(x1, x2[, out, where])

Return (x1 == x2) element-wise.

greater(x1, x2[, out])

Return the truth value of (x1 > x2) element-wise.

greater_equal(x1, x2[, out])

Return the truth value of (x1 >= x2) element-wise.

isclose(a, b[, rtol, atol, equal_nan])

Return true where two arrays are element-wise equal within a tolerance.

isfinite(x[, out, where])

Test element-wise for finiteness (not infinity or not Not a Number).

less(x1, x2[, out])

Return the truth value of (x1 < x2) element-wise.

less_equal(x1, x2[, out])

Return the truth value of (x1 <= x2) element-wise.

logical_and(x1, x2[, out, where])

Compute the truth value of x1 AND x2 element-wise.

logical_or(x1, x2[, out, where])

Compute the truth value of x1 OR x2 element-wise.

not_equal(x1, x2[, out, where])

Return (x1 != x2) element-wise.

Rounding

around(a[, decimals, out])

Evenly round to the given number of decimals.

ceil(q0[, out, where])

Return the ceiling of the input, element-wise.

floor(x[, out, where])

Return the floor of the input, element-wise.

rint(x[, out, where])

Round elements of the array to the nearest integer.

round(a[, decimals, out])

Evenly round to the given number of decimals.

round_(a[, decimals, out])

Evenly round to the given number of decimals.

Sums/Products

cumsum(a[, axis, dtype, out])

Return the cumulative sum of the elements along a given axis.

mean(a[, axis, dtype, out])

Compute the arithmetic mean along the specified axis.

prod(a[, axis, dtype, out, keepdims])

Return the product of array elements over a given axis.

sum(a[, axis, dtype, out, keepdims])

Sum of array elements over a given axis.

Differentiation

derivative(poly, *diffvars)

Polynomial differential operator.

diff(a[, n, axis, prepend, append])

Calculate the n-th discrete difference along the given axis.

ediff1d(ary[, to_end, to_begin])

Difference between consecutive elements of an array.

gradient(poly)

Polynomial gradient operator.

hessian(poly)

Construct Hessian matrix of polynomials.

Min/Max

amax(a[, axis, out])

Return the maximum of an array or maximum along an axis.

amin(a[, axis, out])

Return the minimum of an array or minimum along an axis.

argmin(a[, axis, out])

Return the indices of the minimum values along an axis.

argmax(a[, axis, out])

Return the indices of the maximum values along an axis.

max(a[, axis, out])

Return the maximum of an array or maximum along an axis.

maximum(x1, x2[, out])

Element-wise maximum of array elements.

min(a[, axis, out])

Return the minimum of an array or minimum along an axis.

minimum(x1, x2[, out])

Element-wise minimum of array elements.

Conditionals

choose(a, choices[, out, mode])

Construct array from an index array and a set of arrays to choose from.

count_nonzero(x[, axis])

Count the number of non-zero values in the array a.

nonzero(x, **kwargs)

Return the indices of the elements that are non-zero.

where(condition, *args)

Return elements chosen from x or y depending on condition.

Save/Load

load(file[, mmap_mode, allow_pickle, ...])

Load polynomial or pickled objects from .np{y,z} or pickled files.

loadtxt(fname[, dtype, comments, delimiter, ...])

Load data from a text file.

save(file, arr[, allow_pickle, fix_imports])

Save polynomial array to a binary file in NumPy .npy format.

savetxt(fname, X[, fmt, delimiter, newline, ...])

Save a polynomial array to a text file.

savez(file, *args, **kwargs)

Save several arrays into a single file in uncompressed .npz format.

savez_compressed(file, *args, **kwargs)

Save several arrays into a single file in uncompressed .npz format.

Stacking/Splitting

array_split(ary, indices_or_sections[, axis])

Split an array into multiple sub-arrays.

concatenate(arrays[, axis, out])

Join a sequence of arrays along an existing axis.

dsplit(ary, indices_or_sections)

Split array into multiple sub-arrays along the 3rd axis (depth).

dstack(tup)

Stack arrays in sequence depth wise (along third axis).

hsplit(ary, indices_or_sections)

Split an array into multiple sub-arrays horizontally (column-wise).

hstack(tup)

Stack arrays in sequence horizontally (column wise).

split(ary, indices_or_sections[, axis])

Split an array into multiple sub-arrays.

stack(arrays[, axis, out])

Join a sequence of arrays along a new axis.

vsplit(ary, indices_or_sections)

Split an array into multiple sub-arrays vertically (row-wise).

vstack(tup)

Stack arrays in sequence vertically (row wise).

Shape manipulation

atleast_1d(*arys)

Convert inputs to arrays with at least one dimension.

atleast_2d(*arys)

View inputs as arrays with at least two dimensions.

atleast_3d(*arys)

View inputs as arrays with at least three dimensions.

broadcast_arrays(*args, **kwargs)

Broadcast any number of arrays against each other.

expand_dims(a, axis)

Expand the shape of an array.

moveaxis(a, source, destination)

Move axes of an array to new positions.

repeat(a, repeats[, axis])

Repeat elements of an array.

reshape(a, newshape[, order])

Give a new shape to an array without changing its data.

tile(A, reps)

Construct an array by repeating A the number of times given by reps.

transpose(a[, axes])

Permute the dimensions of an array.

Miscellaneous

abs(x[, out, where])

Calculate the absolute value element-wise.

absolute(x[, out, where])

Calculate the absolute value element-wise.

apply_along_axis(func1d, axis, arr, *args, ...)

Apply a function to 1-D slices along the given axis.

apply_over_axes(func, a, axes)

Apply a function repeatedly over multiple axes.

array_repr(arr[, max_line_width, precision, ...])

Return the string representation of an array.

array_str(a[, max_line_width, precision, ...])

Return a string representation of the data in an array.

common_type(*arrays)

Return a scalar type which is common to the input arrays.

copyto(dst, src[, casting, where])

Copy values from one array to another, broadcasting as necessary.

result_type(*arrays_and_dtypes)

Return the type that results from applying type promotion rules.

Global options

global_options(**kwargs)

Temporarily set global numpoly options.

get_options([defaults])

Get global numpoly options.

set_options(**kwargs)

Set global numpoly options.

Utilities

cross_truncate(indices, bound, norm)

Truncate of indices using L_p norm.

FeatureNotSupported

Error for features in numpy not supported in Numpoly.

glexindex(start[, stop, dimensions, ...])

Generate graded lexicographical multi-indices for the monomial exponents.

glexsort(keys[, graded, reverse])

Sort keys using graded lexicographical ordering.