numpy — 0.3.0

org.pycforge.numpy · Author: PyCForge

License: GPL-3.0-only · Created: 2026-10-31

Runtime conversion · Direct declared calls

Function index

absolute · add · argmax · argmin · array · concatenate · copy · divide · full · max · min · multiply · negative · ones · sqrt · subtract · zeros

Overview

A bounded NumPy conversion package for one-dimensional finite float64 arrays.

Using this import

Select Runtime and declare *import numpy as np. Use np.array(values, dtype="float64"). Read results with indexing or tolist(); copy with np.copy(a) or a.copy().

Author's limitations

One-dimensional contiguous finite float64 arrays only; no dtype inference, views, slicing, array broadcasting or external buffers. Assignment and argument passing share the same array; constructors, copy and arithmetic allocate independent storage. Integer indexing (including negatives), finite numeric item assignment, len, iteration/reversed, copy()/tolist() and shape/size/ndim are supported. Nonfinite inputs and arithmetic overflow are explicitly outside this profile; NumPy warning/seterr policies are not implemented. Allocation and work share the Runtime context budgets. Budget exhaustion is fatal; ordinary type, shape and bounds errors are catchable. Returned arrays stay valid within their originating context until destruction or explicit collection without a live root. Runtime only; no Python/NumPy runtime or arbitrary native dependencies in generated C. Profile 0.2 adds min/max (float64) and argmin/argmax (int64) module functions on supported arrays. axis defaults to None; only None, integer 0 or -1 are accepted. Empty inputs raise ValueError. No sequence coercion, axis tuples, keepdims, out, initial, where, reduction methods or other reductions. When the selected minimum/maximum is zero and both zero signs occur, min/max raise ValueError: NumPy's zero sign can depend on reduction order. Single-sign zero extrema retain their sign. Index reductions accept mixed zero signs and return the first tied index. Scalar results have independent value ownership. Profile 0.3 adds divide, negative, absolute, sqrt and concatenate module functions. Unary functions require an array. Divide requires at least one array, equal array lengths and nonzero divisors. Negative square roots and nonfinite results raise explicit profile errors instead of NumPy warnings/NaNs. Concatenate accepts a nonempty list/tuple of supported arrays and axis=None, 0 or -1. New results have independent storage; inputs are never mutated. No out/where/dtype/casting options, coercion, views or additional operators are added. Array printing/formatting, comparisons, dtype objects, NumPy scalar object identity and warning/seterr behavior are unsupported. Arithmetic overflow is refused explicitly; no silent approximation.

Release notes

Adds divide, negative, absolute, sqrt and concatenate through profile 0.3. Reference fixtures generated with NumPy 2.5.4.

Examples are author-supplied fixture snapshots. The SDK reports verification for its recorded environment; PyCForge registration does not rerun them.

Conversion contract

Use *import numpy in the module preamble. Each signature states accepted positions, names and defaults. A slash marks positional-only parameters; a star marks keyword-only parameters. Argument expansion, function values and Typed conversion are unsupported.

One-dimensional contiguous finite float64 arrays only; no dtype inference, views, slicing, array broadcasting or external buffers. Assignment and argument passing share the same array; constructors, copy and arithmetic allocate independent storage. Integer indexing (including negatives), finite numeric item assignment, len, iteration/reversed, copy()/tolist() and shape/size/ndim are supported. Nonfinite inputs and arithmetic overflow are explicitly outside this profile; NumPy warning/seterr policies are not implemented. Allocation and work share the Runtime context budgets. Budget exhaustion is fatal; ordinary type, shape and bounds errors are catchable. Returned arrays stay valid within their originating context until destruction or explicit collection without a live root. Runtime only; no Python/NumPy runtime or arbitrary native dependencies in generated C. Profile 0.2 adds min/max (float64) and argmin/argmax (int64) module functions on supported arrays. axis defaults to None; only None, integer 0 or -1 are accepted. Empty inputs raise ValueError. No sequence coercion, axis tuples, keepdims, out, initial, where, reduction methods or other reductions. When the selected minimum/maximum is zero and both zero signs occur, min/max raise ValueError: NumPy's zero sign can depend on reduction order. Single-sign zero extrema retain their sign. Index reductions accept mixed zero signs and return the first tied index. Scalar results have independent value ownership. Profile 0.3 adds divide, negative, absolute, sqrt and concatenate module functions. Unary functions require an array. Divide requires at least one array, equal array lengths and nonzero divisors. Negative square roots and nonfinite results raise explicit profile errors instead of NumPy warnings/NaNs. Concatenate accepts a nonempty list/tuple of supported arrays and axis=None, 0 or -1. New results have independent storage; inputs are never mutated. No out/where/dtype/casting options, coercion, views or additional operators are added.

numpy.absolute(x, /) -> array1d-float64

Return each element's absolute value in independent storage; negative zero becomes positive zero.

x: positional-only; required

Return each element's absolute value in independent storage; negative zero becomes positive zero.

Return each element's absolute value in independent storage; negative zero becomes positive zero.

Argument 1: x: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: elementwise

numpy.add(x1, x2, /) -> array1d-float64

Add two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

x1: positional-only; required

x2: positional-only; required

Add two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

Add two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

Argument 1: x1: See the fixed operation signature and contract.

Argument 2: x2: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: arithmetic

numpy.argmax(a, axis=None) -> int64

Return the int64 index of the first maximum in a nonempty supported array. Equal values, including signed zeros, keep the first index. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

a: positional-or-keyword; required

axis: positional-or-keyword; default None

Return the int64 index of the first maximum in a nonempty supported array. Equal values, including signed zeros, keep the first index.

Result must fit signed int64; nonfinite or out-of-range results raise an exception.

Return the int64 index of the first maximum in a nonempty supported array. Equal values, including signed zeros, keep the first index. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

Argument 1: a: A supported finite float64 array; reductions require at least one element.

Argument 2: axis: None, integer 0 or -1; reductions default to None and concatenate defaults to 0. No axis tuples or booleans.

Returns: An independent int64 scalar; the input array is unchanged.

View example: reductions

numpy.argmin(a, axis=None) -> int64

Return the int64 index of the first minimum in a nonempty supported array. Equal values, including signed zeros, keep the first index. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

a: positional-or-keyword; required

axis: positional-or-keyword; default None

Return the int64 index of the first minimum in a nonempty supported array. Equal values, including signed zeros, keep the first index.

Result must fit signed int64; nonfinite or out-of-range results raise an exception.

Return the int64 index of the first minimum in a nonempty supported array. Equal values, including signed zeros, keep the first index. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

Argument 1: a: A supported finite float64 array; reductions require at least one element.

Argument 2: axis: None, integer 0 or -1; reductions default to None and concatenate defaults to 0. No axis tuples or booleans.

Returns: An independent int64 scalar; the input array is unchanged.

View example: reductions

numpy.array(object, dtype) -> array1d-float64

Copy a flat numeric list, tuple or supported array into new float64 storage. Explicit dtype='float64' is required; no dtype inference.

object: positional-or-keyword; required

dtype: positional-or-keyword; required

Copy a flat numeric list, tuple or supported array into new float64 storage. Explicit dtype='float64' is required; no dtype inference.

Copy a flat numeric list, tuple or supported array into new float64 storage. Explicit dtype='float64' is required; no dtype inference.

Argument 1: object: See the fixed operation signature and contract.

Argument 2: dtype: Float64 string; required unless the signature supplies its default.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: constructors

numpy.concatenate(arrays, /, axis=0) -> array1d-float64

Join a nonempty list or tuple of supported arrays into independent storage. Empty constituent arrays are allowed. axis accepts None, 0 or -1; no out, dtype or casting overrides.

arrays: positional-only; required

axis: positional-or-keyword; default 0

Join a nonempty list or tuple of supported arrays into independent storage. Empty constituent arrays are allowed. axis accepts None, 0 or -1; no out, dtype or casting overrides.

Join a nonempty list or tuple of supported arrays into independent storage. Empty constituent arrays are allowed. axis accepts None, 0 or -1; no out, dtype or casting overrides.

Argument 1: arrays: See the fixed operation signature and contract.

Argument 2: axis: None, integer 0 or -1; reductions default to None and concatenate defaults to 0. No axis tuples or booleans.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: concatenation

numpy.copy(a) -> array1d-float64

Copy a supported array into independent writable storage. Assignment alone shares the original array.

a: positional-or-keyword; required

Copy a supported array into independent writable storage. Assignment alone shares the original array.

Copy a supported array into independent writable storage. Assignment alone shares the original array.

Argument 1: a: A supported finite float64 array; reductions require at least one element.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: independent-copies

numpy.divide(x1, x2, /) -> array1d-float64

Divide two equal-length float64 arrays, or an array and a numeric scalar, into independent storage. A zero divisor or nonfinite result is outside the finite profile and raises an exception.

x1: positional-only; required

x2: positional-only; required

Divide two equal-length float64 arrays, or an array and a numeric scalar, into independent storage. A zero divisor or nonfinite result is outside the finite profile and raises an exception.

Divide two equal-length float64 arrays, or an array and a numeric scalar, into independent storage. A zero divisor or nonfinite result is outside the finite profile and raises an exception.

Argument 1: x1: See the fixed operation signature and contract.

Argument 2: x2: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: elementwise

numpy.full(shape, fill_value, dtype) -> array1d-float64

Create a one-dimensional array filled with one numeric value. Explicit dtype='float64' is required.

shape: positional-or-keyword; required

fill_value: positional-or-keyword; required

dtype: positional-or-keyword; required

Create a one-dimensional array filled with one numeric value. Explicit dtype='float64' is required.

Create a one-dimensional array filled with one numeric value. Explicit dtype='float64' is required.

Argument 1: shape: See the fixed operation signature and contract.

Argument 2: fill_value: See the fixed operation signature and contract.

Argument 3: dtype: Float64 string; required unless the signature supplies its default.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: constructors

numpy.max(a, axis=None) -> float64

Return the maximum finite float64 value of a nonempty supported array, without modifying it or allocating array storage. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

a: positional-or-keyword; required

axis: positional-or-keyword; default None

Return the maximum finite float64 value of a nonempty supported array, without modifying it or allocating array storage.

Return the maximum finite float64 value of a nonempty supported array, without modifying it or allocating array storage. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

Argument 1: a: A supported finite float64 array; reductions require at least one element.

Argument 2: axis: None, integer 0 or -1; reductions default to None and concatenate defaults to 0. No axis tuples or booleans.

Returns: An independent float64 scalar; the input array is unchanged.

View example: reductions

numpy.min(a, axis=None) -> float64

Return the minimum finite float64 value of a nonempty supported array, without modifying it or allocating array storage. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

a: positional-or-keyword; required

axis: positional-or-keyword; default None

Return the minimum finite float64 value of a nonempty supported array, without modifying it or allocating array storage.

Return the minimum finite float64 value of a nonempty supported array, without modifying it or allocating array storage. axis accepts None, 0 or -1. Empty arrays raise ValueError. No out/keepdims/where/initial, sequence coercion or method form. Min/max reject mixed-sign zero extrema; argmin/argmax keep the first tied index.

Argument 1: a: A supported finite float64 array; reductions require at least one element.

Argument 2: axis: None, integer 0 or -1; reductions default to None and concatenate defaults to 0. No axis tuples or booleans.

Returns: An independent float64 scalar; the input array is unchanged.

View example: reductions

numpy.multiply(x1, x2, /) -> array1d-float64

Multiply two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

x1: positional-only; required

x2: positional-only; required

Multiply two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

Multiply two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

Argument 1: x1: See the fixed operation signature and contract.

Argument 2: x2: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: arithmetic

numpy.negative(x, /) -> array1d-float64

Negate every element of a supported array into independent storage, preserving IEEE signed-zero negation.

x: positional-only; required

Negate every element of a supported array into independent storage, preserving IEEE signed-zero negation.

Negate every element of a supported array into independent storage, preserving IEEE signed-zero negation.

Argument 1: x: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: elementwise

numpy.ones(shape, dtype='float64') -> array1d-float64

Create a one-dimensional float64 array filled with one; shape is an integer or a one-item tuple/list.

shape: positional-or-keyword; required

dtype: positional-or-keyword; default 'float64'

Create a one-dimensional float64 array filled with one; shape is an integer or a one-item tuple/list.

Create a one-dimensional float64 array filled with one; shape is an integer or a one-item tuple/list.

Argument 1: shape: See the fixed operation signature and contract.

Argument 2: dtype: Float64 string; required unless the signature supplies its default.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: constructors

numpy.sqrt(x, /) -> array1d-float64

Take the square root of each nonnegative element of a supported array into independent storage. Negative elements are outside the finite real profile and raise ValueError.

x: positional-only; required

Take the square root of each nonnegative element of a supported array into independent storage. Negative elements are outside the finite real profile and raise ValueError.

Take the square root of each nonnegative element of a supported array into independent storage. Negative elements are outside the finite real profile and raise ValueError.

Argument 1: x: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: elementwise

numpy.subtract(x1, x2, /) -> array1d-float64

Subtract two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

x1: positional-only; required

x2: positional-only; required

Subtract two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

Subtract two equal-length float64 arrays, or an array and a numeric scalar, into new storage.

Argument 1: x1: See the fixed operation signature and contract.

Argument 2: x2: See the fixed operation signature and contract.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: arithmetic

numpy.zeros(shape, dtype='float64') -> array1d-float64

Create a one-dimensional float64 array filled with zero; shape is an integer or a one-item tuple/list.

shape: positional-or-keyword; required

dtype: positional-or-keyword; default 'float64'

Create a one-dimensional float64 array filled with zero; shape is an integer or a one-item tuple/list.

Create a one-dimensional float64 array filled with zero; shape is an integer or a one-item tuple/list.

Argument 1: shape: See the fixed operation signature and contract.

Argument 2: dtype: Float64 string; required unless the signature supplies its default.

Returns: A new independent one-dimensional float64 array owned by the Runtime context.

View example: constructors

Verified fixture examples

Example: arithmetic

*import numpy as np
def main():
    a=np.array([1, 2, -3], dtype="float64")
    b=np.array([2, -1, 4], dtype="float64")
    print(np.add(a,b).tolist(), np.subtract(a,b).tolist(), np.multiply(a,b).tolist())
    print((a+b).tolist(), (a-b).tolist(), (a*b).tolist())
    print((2+a).tolist(), (2-a).tolist(), (2*a).tolist())
    print((a+2).tolist(), (a-2).tolist(), (a*2).tolist())
    print((-a).tolist(), (+a).tolist())
    return 0

Expected standard output:

[3.0, 1.0, 1.0] [-1.0, 3.0, -7.0] [2.0, -2.0, -12.0]
[3.0, 1.0, 1.0] [-1.0, 3.0, -7.0] [2.0, -2.0, -12.0]
[3.0, 4.0, -1.0] [1.0, 0.0, 5.0] [2.0, 4.0, -6.0]
[3.0, 4.0, -1.0] [-1.0, 0.0, -5.0] [2.0, 4.0, -6.0]
[-1.0, -2.0, 3.0] [1.0, 2.0, -3.0]

Expected exit code: 0

Example: concatenation

*import numpy as np
def main():
    a=np.array([1,2],dtype="float64")
    b=np.array([-0.0,3],dtype="float64")
    empty=np.zeros(0)
    c=np.concatenate((a,empty,b),axis=-1)
    c[0]=99
    print(c.tolist(),a.tolist(),b.tolist())
    print(np.concatenate([empty],axis=None).tolist())
    print(np.concatenate([a,b]).tolist())
    return 0

Expected standard output:

[99.0, 2.0, -0.0, 3.0] [1.0, 2.0] [-0.0, 3.0]
[]
[1.0, 2.0, -0.0, 3.0]

Expected exit code: 0

Example: constructors

*import numpy as np
def main():
    a=np.array([1, 2.5, True], dtype="float64")
    print(a.tolist(), a.shape, a.size, a.ndim, len(a))
    print(np.zeros(3).tolist(), np.ones((2,)).tolist())
    print(np.full([3], -2, dtype="float64").tolist())
    return 0

Expected standard output:

[1.0, 2.5, 1.0] (3,) 3 1 3
[0.0, 0.0, 0.0] [1.0, 1.0]
[-2.0, -2.0, -2.0]

Expected exit code: 0

Example: elementwise

*import numpy as np
def main():
    a=np.array([-4, -0.0, 9, 16], dtype="float64")
    print(np.negative(a).tolist())
    print(np.absolute(a).tolist())
    print(np.sqrt(np.absolute(a)).tolist())
    print(np.divide(a,2).tolist())
    print(np.divide(2,np.array([1,2,4,8],dtype="float64")).tolist())
    print(a.tolist())
    return 0

Expected standard output:

[4.0, 0.0, -9.0, -16.0]
[4.0, 0.0, 9.0, 16.0]
[2.0, 0.0, 3.0, 4.0]
[-2.0, -0.0, 4.5, 8.0]
[2.0, 1.0, 0.5, 0.25]
[-4.0, -0.0, 9.0, 16.0]

Expected exit code: 0

Example: independent-copies

*import numpy as np
def main():
    a=np.array([1, 2], "float64")
    b=a
    c=np.copy(a)
    d=np.array(a, dtype="float64")
    e=a.copy()
    b[0]=9
    print(a.tolist(), c.tolist(), d.tolist(), e.tolist(), a is b, a is c)
    return 0

Expected standard output:

[9.0, 2.0] [1.0, 2.0] [1.0, 2.0] [1.0, 2.0] True False

Expected exit code: 0

Example: reductions

*import numpy as np
def main():
    a=np.array([4, -3, 8, -3, 8], dtype="float64")
    print(np.min(a), np.max(a), np.argmin(a), np.argmax(a))
    print(np.min(a, 0), np.max(a, -1), np.argmin(a, axis=None), np.argmax(a, axis=0))
    print(a.tolist())
    return 0

Expected standard output:

-3.0 8.0 1 2
-3.0 8.0 1 2
[4.0, -3.0, 8.0, -3.0, 8.0]

Expected exit code: 0