{ } Raw JSON

bundles / scipy 1.17.1 / scipy / _lib / _array_api_override / array_namespace

function

scipy._lib._array_api_override:array_namespace

source: /scipy/_lib/_array_api_override.py :69

Signature

def   array_namespace ( * arrays : Array )  →  ModuleType

Summary

Get the array API compatible namespace for the arrays xs.

Parameters

*arrays : sequence of array_like

Arrays used to infer the common namespace.

Returns

namespace : module

Common namespace.

Notes

Wrapper around array_api_compat.array_namespace.

  • Check for the global switch SCIPY_ARRAY_API. If disabled, just return array_api_compat.numpy namespace and skip all compliance checks.

  • Check for known-bad array classes. The following subclasses are not supported and raise and error:

  • Coerce array-likes to NumPy arrays and check their dtype. Note that non-scalar array-likes can't be mixed with non-NumPy Array API objects; e.g.

    • array_namespace([1, 2]) returns NumPy namespace;

    • array_namespace(np.asarray([1, 2], [3, 4]) returns NumPy namespace;

    • array_namespace(cp.asarray([1, 2], [3, 4]) raises an error.

Aliases

  • scipy.differentiate.array_namespace